Question

Data grid with information loaded via a CSV file. Users need to be able to filter the datagrid results via 2 combo boxes.

When I use

var objRow:Object;
var rowNumber:Number = codes_cb.selectedItem.data;  
objRow = myGrid.getItemAt(rowNumber);

It returns the row object which is fine. However , I need to trace a specific cell value from that row. This works fine as a static trace:

trace(objRow.SelectAgreement);

"SelectAgreement" is the column header for one of the columns, But i need the "SelectAgreement" part to be dynamic.

Is there a variable type that can be used here? I've tried:

trace(objRow.codes_cb.selectedItem.label);
Was it helpful?

Solution

you can refer to properties of Objects in a similar way to how you refer to entries in an Array. EG:

var propName:String = "SelectAgreement";//the property to access
trace(objRow[propName]);//will trace the property value

So if you have a combo box with which lists these property names literally:

trace(objRow[comboBoxWithPropNames.selectedItem]);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top