You need to sign in to do that
Don't have an account?
Flex Datagrid Bind Accounts List with CheckBox selecte/deselect
Hi Folks,
I created a DataGrid in Flex and bind a ArrayCollection of Acounts with Datagrid
The bind is with Account sObjet ArrayCollection.
I want to maintain a checkbox on every record so that when user clicks save i can identify on iteration that which record is selected
Please guide me the right way to implement this thing in flex
Following is the code ===========================================================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<mx:Application............................
[Bindable]
private var accs:ArrayCollection;
private function init(flag:int):void
{
var lr:LoginRequest = new LoginRequest();
lr.username = "";
lr.password = "";
lr.callback = new AsyncResponder(loginHandler);
force.login(lr);
}
private function loginHandler(result:LoginResult):void
{
force.query("Select Id From Account", new AsyncResponder(queryHandler));
}
private function queryHandler(result:QueryResult):void
{
accs= result.records;
}
<mx:DataGrid id="dg" dataProvider="{opps}" editable="true">
<mx:columns>
<mx:DataGridColumn headerText="Job Manager" dataField="Jmgr__c" editable="true" /> </mx:columns>
</mx:DataGrid>
</mx:Application>
You can write an itemrenderer as a checkbox for a column in the datagrid. When the checkbox is checked write a method that adds the ID of the object to an ArrayCollection. You can then use this ArrayCollection for processing.
Also, you will need to listen for events that uncheck the box so that you can remove the ID from your ArrayCollection if it exists.
You might want to check out http://blog.flexexamples.com/ for sample code.
HTH
Jeff Douglas
http://blog.jeffdouglas.com
Appirio