Actionscript – Disable rows in Flex DataGrid


Unless I'm missing something obvious here, there is no way of disbabling one or more rows in a DataGrid. I would expect a disabledRows or disabledRowIndidices property on the DataGrid or List component but that doesn't seem to exist.

I found a "rendererArray" property which is scoped to mx_internal and contains all itemrenderers of all cells in the datagrid. So I can check the type and the value of the data inside the renderer and enable or disable all cells of the same row, but that feels too much like a hack.

Any suggestions?

Edit: I realize that disabling a row could mean different things. In my case it means not being able to edit the row even when the editable property of the datagrid is set to true. It could however also mean not being able to select a row, but that's not what I'm looking for.

Best Solution

To do this you will need some data for that row to signify that it is uneditable. Then when the "itemEditBeginning" then check the data or row index to enable/disable the default behavior with event.preventDefault ...

public function preventEditing(event:DataGridEvent):void
    var status : Boolean = ArrayObjs[rowIndex].isYourCondition;

    if (status == true)

The other option is to make a custom ItemRenderer for your data cell but don't think that is what you want as you would need to make it for each of your cells.

Related Question