5/31/2010 7:41:50 PM
Title:
datagrid CheckBox Item Renderer
Hi,
I have a datagrid inside check box itemrenderer. my datagrid column like
Isselected Title
CheckBox1 RAMA
CheckBox2 Krishna
CheckBox3 Venkat
CheckBox4 xxxxxx
Creating project:
I am selecting check boxes 1 and 4 and send to the database.
My question is,
Updating project:
Whenever i am updating the project, Out of four checkboxes only i was Selected two check boxes only and i am selecting one more checkbox. How to show checkboxes selected true from the data coming from the database?
How to checking the conditon? Please any one having the code, please send me ? Its urgent.
Thanks
Rama
Davis
Points: 780
Posts:0
5/31/2010 9:58:01 PM
To maintain the state of your checkbox in Datagrid on refresh you need to provide the dataProvider to Datagrid from database. On load of you application you should call the server page which will return you the xml from database and set that xml as dataProvider for your datagrid.
5/31/2010 11:43:17 PM
you need to receive the xml from server and set the status of checkboxes initially when the application is started. Check the following example to populate a datagrid using the xml as dataprovider and setting the checkbox status from xml nodes.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" horizontalAlign="center" verticalAlign="middle">
<mx:XMLList id="myXML" xmlns="">
<node isChecked="true" name="chk1" Colum1="abc1"/>
<node isChecked="false" name="chk2" Colum1="abc2"/>
<node isChecked="true" name="chk3" Colum1="abc3"/>
</mx:XMLList>
<mx:DataGrid id="dataGrid" dataProvider="{myXML}" editable="true">
<mx:columns>
<mx:DataGridColumn width="25" headerText=" " editable="false">
<mx:itemRenderer>
<mx:Component>
<mx:CheckBox selected="{(data.@isChecked == 'true')?true:false}"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn dataField="@name" headerText="Name"/>
<mx:DataGridColumn dataField="@Colum1" headerText="Colum"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>
1/12/2012 8:57:22 AM
thanks for your efforts, I tried this, however hitting issues, and tried in another way which is working for me, code posted at my blog http://bbso.wordpress.com