I have a check box in an advancedatagrid along with other fields. They all
show up as does the checkbox. I can check the box(es). There is a button that
will then process the selected records.
I start a loop on the grid, but I don't know where to go from there. The two
things I want to do is 1) if the row is checked, add it to an array for further
processing and 2) when coming into the array clear any checks still in there
from the last time.
The user will click on array1 and the data is used to populate array2 with
details. Array2 also has the checkbox in an itemrenderer and below it a
process button. You click the records you want processed then the button to
build an array of selected records that are passed on for further processing.
The array code looks like this:
<cust:MyAdvancedDataGrid
id="dg2"
resizableColumns="true"
height="100%" width="100%"
editable="false"
styleName="mainGrid"
dataProvider="{model.userAARetrieveList}"
headerStyleName="datagridHeaderStyles"
selectionMode="singleCell"
accessibilityName="A and A Report History List, DataGrid, use arrow
keys to navigate between cells">
<cust:columns>
<mx:AdvancedDataGridColumn
id="select"
headerText="Select"
itemRenderer="gov.il.dhs.wvs.view.renderers.UserAA_Chck_Renderer"
width="45"/>
<mx:AdvancedDataGridColumn
headerText="Week Ending"
itemRenderer="gov.il.dhs.wvs.view.renderers.UserAA_WE_Renderer"
width="85"/>
more columns...
The processing button code looks like this:
// bottom grid clicked
var dg2AC:ArrayCollection = new ArrayCollection();
for each (var obj:Object in dg2.dataProvider)
{
if (obj.select.selected)
{
dg2AC.addItem(obj);
}
}
if (dg2AC.length == 0)
return;
(new UserAAInsertEvent(dg2AC as UserAAInsertVO)).dispatch();
I've spent the last hour reviewing blogs and such, but can't seem to find the
right stuff.