문제

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);
도움이 되었습니까?

해결책

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]);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top