The signature for labelFunction is:
myLabelFunction(item:Object, column:DataGridColumn):String
where item contains the DataGrid item object, and column specifies the DataGrid column. So with flat data you can get the value you need to format with item[column.dataField].
However with heirarchical data you are given the whole "folder" - i.e. all the items in the heirarchy - in the 开发者_开发问答item parameter so how can you choose which one to use?
Eg. with weather data organized heirarchically by state groups
Arizona - maxTemp - Jan, Feb, March, April
Arizona - minTemp - Jan, Feb, March, April
California - maxTemp - Jan, Feb, March, April
California - minTemp - Jan, Feb, March, April
If you want to format this, you'll be given the entire Arizona item with a children array containing both maxTemp and minTemp data, there is no way to tell whether you are formatting maxTemp or minTemp. Or is there???
Wait... it seems to work after all. I don't get it but anyway item[column.dataField] works.
精彩评论