开发者

data vs listData in Flex itemRenderer

开发者 https://www.devze.com 2023-03-25 12:54 出处:网络
I was wondering what the difference between data and listData in itemRenderers in flex. I have worked with data in all of my itemRenderers.

I was wondering what the difference between data and listData in itemRenderers in flex. I have worked with data in all of my itemRenderers.

Basically I want to know when to use wh开发者_运维知识库ich, where each gets set and if I can use them together?

Note that I am asking from a Flex3 point of view.


data is the data that the renderer should display. Use it to work with the original data currently assigned to the renderer.

listData is an additional object to provide you with information about the role of the renderer in the list (rowIndex, columnIndex, list component, uid, ...). Use it to perform some UI related operations such as formatting the first row differently or rows alternating depending on their vertical index, calling the list view component, etc.


Each item of your dataProvider collection is passed to data variable. You entirely define, what is passed to data by defining dataProvider content.
Information about the cell of datagrid/list (such as row/column index, label) is passed to listData (see BaseListData). To use this variable your itemrenderer should implement IDropInListItemRenderer interface.


See details about listData here. The main point is:

The list classes will pass more information to the renderer so that it can determine which field to use at run-time.

So listData is for advanced usage for more complicated item renderers.


See this:

http://livedocs.adobe.com/flex/3/html/help.html?content=cellrenderer_4.html

And this:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/listClasses/IDropInListItemRenderer.html

0

精彩评论

暂无评论...
验证码 换一张
取 消