如何向MobileIconItemRenderer中的decoratorClass传递参数?
如何将参数传递给 MobileIconItemRenderer 中的decoratorClass?我有一个自定义控件来显示指标(从数据收集中获取),该控件将用作 decoetorClass,我的问题是我无法在自定义控件上设置指标参数,您可以在下面找到示例代码。如何将值传递给我的自定义组件的实例?存在任何方式,或者我必须重新制作 MobileIconItemRenderer 类?
<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>
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个示例。但是,建议根据数据设置不同的装饰器类。
这是一个不同的示例,这似乎完成了同样的事情,但没有使用装饰器来做到这一点。
似乎没有文档化的 API 可用于访问装饰器的实例,但我敢打赌,如果您深入研究代码,一定有办法。
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.