Question

I'm coding a generic <s:GridItemEditor> for spark DataGrid, to create dynamically an appropiate UIComponent for edition, depending on properties types.

Some properties linked to GridColumn's are complex, like:

var gridColumn:GridColumn = new GridColumn("Category.Description");

I'm having this error with this complex properties:

ReferenceError: Error #1069: Property Category.Description not found on GOClases.Person and there is no default value.....

at spark.components.gridClasses::GridItemEditor/set data()[E:\dev\hero_private\frameworks\projects\spark\src\spark\components\gridClasses\GridItemEditor.as:176]**

This is the specific function where this error ocurrs:

public function set data(value:Object):void
{
    _data = value;

    if (_data && column.dataField)
    {
        this.value = _data[column.dataField];
    }
}

Is it possible to avoid this error redefining properly the set data() function? How can I workaround this?

Is it possible to define differents properties as label and itemEditor in spark DataGrid?

Thanks a lot.

Was it helpful?

Solution

This is how I solved: it's make more sense assign Object type properties to GridColumn's dataField var gridColumn:GridColumn = new GridColumn("Category"); and use labelFunction to evaluate dynamically complex properties, I used r1.deval.D library here to resolve it:

private function funcionEtiqueta(item:Object, column:GridColumn):String
{
     D.eval(complexProperty,item).toString();
}

Maybe this would help somebody else. Thanks.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top