How to pass parameters to decoratorClass in MobileIconItemRenderer?
How to pass parameters to decoratorClass in MobileIconItemRenderer ? I have a custom开发者_开发知识库 control to display a metric (get from data collection), this control will be used as decoretorClass, my problem is that I couldn't set the metric parameter on my custom control, you can find below a sample code. How to do to pass values to a instance for my custom component ? Exist any way, or I have to re-make the MobileIconItemRenderer class ?
<s:List id="dealList" top="0" bottom="0" left="0" right="0" width="100%" height="100%"
dataProvider="{dealService.lastResult.Response.Items.Item}" >
<s:itemRenderer>
<fx:Component>
<s:MobileIconItemRenderer label="{data.Metric_Name}" messageField="Customer" decoratorClass="{MetricViewer}">
<fx:Script>
<![CDATA[
import mobile.ui.component.mxml.MetricViewer;
]]>
</fx:Script>
</s:MobileIconItemRenderer>
</fx:Component>
</s:itemRenderer>
Here is one example. However, it suggest to set a different decorator class based on the data.
Here is a different example, that seems to accomplish the same thing but does not use a decorator to do so.
There does not seem to be a documented API that you can use to access the instance of the decorator, but I bet if you drill into the code there is a way.
精彩评论