I wanna put button object in odd rows in the datagrid, and
put checkbox object in even rows .
How can i do this?
I can now only use ItemRender property to put objects in all
rows in a column in the datagrid~~
You have to use a single itemRenderer. You should create BOTH
a Button and a CheckBox and make them both have visible="false".
Override the itemRenderer's updateDisplayList function and test the
itemRenderer's listData.rowIndex property and use it to determine
which component to hide and which to show.
The reason you want both is that itemRenderers are re-used
when you scroll. A renderer might be for an odd-row, then when you
scroll it might be for an even row. Scroll enough and all of the
itemRenderers will be used for both odd and even rows so you'll
need to have bother child components ready. It is faster to create
both up front and hide and show them as necessary than it would be
to create and destroy them or even add and remove them.
Note: if your itemRenderer does not have a listData property,
then implement the IDropInListItemRenderer interface (see the
documentation for an example).