gagaliya
asked on
Easy way to prevent a user from unchecking a checkbox in a datagrid
Hi i have a checkbox datagridcolumn inside a datagrid, how can i prevent user from unchecking the checkbox located in first row without creating a whole itemrenderer etc..
//someArray is bindable
<mx:DataGrid id="somegrid" dataProvider="{someArray}" >
<mx:columns>
....etc...
<mx:DataGridColumn dataField="isChecked" rendererIsEditor="true" editorDataField="selected" >
<mx:itemRenderer>
<fx:Component>
<mx:CheckBox click="outerDocument.displayCheckBox_clickHandler()" />
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
public function displayCheckBox_clickHandler():void
{
if(somegrid.selectedIndex==0)
{
// set the filterArray[0].isChecked = true
// basically check the checkbox again, but this does NOT work, the filterArray[0].isChecked is set to false again.
// i think due to the way the events are ran.
//This is my question, how do you prevent a user from unchecking the checkbox in first row of the datagrid
//OR to auto recheck it after they uncheck it.
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks that's exactly what I was looking for.
Not quite sure what xuserx2000 was talking about either.
Not quite sure what xuserx2000 was talking about either.
It will still be visible...but clicking on it will do nothing.