Posts Tagged DataGrid

Updating a nested data object in DataGridColumn itemRenderer does not update DataGrid

If you are using a itemRenderer and updating the dataprovider of the DataGrid within the itemRenderer, you may have to force the DataGrid to update manually.

Read the rest of this entry »

Bookmark and Share

Tags: , ,

Editing Nested Data for Flex DataGrid

I needed to use a nested data object with a DataGrid. By default, the Flex (Moxie) DataGrid will not be able to display data in nested objects directly by using the dataField attribute in DataGridColumn.

An example of my nested object is as follows:

<persons>
    <boy>
        <name>TED</name>
    </boy>
        <name>TIM</name>
    <boy>
    </boy>
    <girl>
        <name>SUE</name>
    </girl>
    <girl>
        <name>ANN</name>
    </girl>
</persons>

Thank God, i found this article: Nested Data in Flex DataGrid by Extending DataGridColumn. I won’t explain how i use it here but you can go check it out there.

Here’s why i blogged about this. Well.. i needed to edit this nested data object. Setting “editable” to true did allow me to change the label but i could not commit the new value. The earlier mentioned blog article did gave me a hint of how to reference the actual field in the data object and i mixed it with the itemEditEnd event to commit the value manually.

Read the rest of this entry »

Bookmark and Share

Tags: , , , , ,

Efficiency in itemRenderers

Been having problems for my itemRenderers in datagrids. I am using Button control as a itemRenderer and setting their visibility based on their labels. Somehow, the buttons becomes visible when my DataGrid dataprovider is changed. 

The reference below solved my problem. I needed to place my logic to set the visible variable in the right place. Rest of the article touches on efficiency.

Reference: Peter Ent - itemRenderers: Part 5: Efficiency

 

 

Bookmark and Share

Tags: , , , ,

Making specific DataGrid rows editable

What happens if you want to make your DataGrid editable but you want to restrict which rows are editable?

<mx:DataGrid dataProvider="{mx.utils.ArrayUtil.toArray(someModel)}" editable="true
itemEditBeginning="onItemBeginning(event)">
<mx:columns>
<mx:DataGridColumn dataField="name" headerText="" width="100"/>
<mx:DataGridColumn dataField="hole1" headerText="1" width="50" editable="true" itemEditor="mx.controls.NumericStepper" editorDataField="value"/>
</mx:columns>
</mx:DataGrid>

private function onItemBeginning(event:DataGridEvent)
{
var item:Object = event.itemRenderer.data; //Does nothing
if (event.rowIndex == 0)
{
event.preventDefault();
}
}

Reference:

  • http://flexblog.faratasystems.com/?p=127
Bookmark and Share

Tags: ,