Flex - Sending a parameter to a custom ItemRenderer?

后端 未结 10 1365
悲哀的现实
悲哀的现实 2020-12-24 07:37

What I am trying to accomplish to to get financial data in my Flex Datagrid to be color-coded--green if it\'s positive; red if it\'s negative. This would be fairly straight

10条回答
  •  鱼传尺愫
    2020-12-24 08:01

    You can access the value of the TextBox directly, if you need to, by using the static Application.application object, which is accessible from anywhere in your application.

    For example, if you wanted the renderers to be notified when the value of the TextInput control changes, you could do something like this (from within your ItemRenderer, and where myTextInput is the ID of the control defined in your main MXML class):

    
        
    
    

    With this approach, each item-renderer object will be notified when the TextInput's text property changes, and you can take appropriate action based on the value of the control at that time. Notice as well that I've set the useWeakReference argument to true in this case, to make sure the listener assignments don't interfere unintentionally with garbage collection. Hope it helps!

提交回复
热议问题