开发者

Flex AdvancedDataGridColumn dataTipFunction query

开发者 https://www.devze.com 2023-02-12 03:06 出处:网络
I\'ve a AdvancedDataGridColumn which has both \'labelFunction\' and \'dataTipFunction\' defined. I want dat开发者_StackOverflow社区aTipFunction to return the output of \'labelFunction\' + someText.

I've a AdvancedDataGridColumn which has both 'labelFunction' and 'dataTipFunction' defined.

I want dat开发者_StackOverflow社区aTipFunction to return the output of 'labelFunction' + someText.

Could anyone please help in this regard?

P.S : The problem here is dataTipFunction doesn't have access to 'column' object.

Thanks.


You can invoke the labelFunction on the datagridcolumn in your dataTipFunction and append something to the result.

var label:String = column.labelFunction(item, column);
return label + someText;

I would however suggest to extract the code that creates the label into its own method and then call this method in both the labelFunction and the dataTipFunction. Since this information is missing, you cannot do this dynamically.


PS: Since the dataTipFunction does not include the column property, you'll need to create a datatip function for each column and add the column information. You can then invoke the labelFunction on the correct column.

private function dataTipFunction1(item:Object):String {
  return getDataTip(item, myFirstColumn);
}

private function dataTipFunction2(item:Object):String {
  return getDataTip(item, mySecondColumn);
}

private function getDataTip(item:Object, column:DataGridColumn):String {
  return column.labelFunction(item, column) + someText;
}
0

精彩评论

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

关注公众号