I have a datagrid loaded with 2 columns. Allowmultiselect is turned on.
Based on the values selected at run time, I get the corresponding selected column name and its values and shown it on HTML screen.
// grp is datagrid
// dgrcl is a data grid column
// selflds is an array which has 0,1,2,3 values
//selflds = name,selflds=age
for (var l:int=0; l<grp.columnCount; l++)
selflds[l] = dgrcl.dataField;
// srhVals will have only one selected value at any point
// getting the corresponding selected column name and its value
srhVals = String(grp.selectedItem[selflds]);
I am trying to achieve the above selection instead by .selectedItems somthing like this below. By doing like this, I will get all the selected items but not only one. If i try below syntax, i get error. Any one has ideas on how to do.
srhVals = String(grp.selectedItems.selflds);
I got my mistake, there should be no dot operator after selectedItems;
I got a solution - it goes like this:
srhVals = srhVals + String(grp.selectedItems[g][selflds]);
So the complete scenario is like this:
I am selecting b,d in UI. At run time, I get programatically the selecteditem column name as "Name", loop through the selecteditems and store the value in srhVals as b,d.
b,d will be finally shown in UI.