Adobe Flex ActionScript Interview Questions and Answers

 

When I have only a single record, why does not it appear in my DataGrid?

This is a known issue that is caused by the inability of Flex to differentiate between
an object and an array with a single row. The solution is to always use toArray(),
as in the following examples:



In MXML:



{mx.utils.ArrayUtil.toArray(modelAccidents1.accidents.accident)}



The inline format:



dataProvider={mx.utils.ArrayUtil.toArray(testSrv.result.result.error)}



In ActionScript:



myControl.dataProvider = mx.utils.ArrayUtil.toArray(testSrv.result.result.error)

Posted by:Richards