Spark DropDownList自定义ItemRenderer问题 [英] Spark DropDownList Custom ItemRenderer Issue

查看:157
本文介绍了Spark DropDownList自定义ItemRenderer问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Spark DropDownList,它有一个自定义的ItemRenderer。 ItemRenderer在创建时检查标签文本,如果它符合某些标准,则标签文本颜色会改变。标签的文字颜色正在改变,但它是用于错误的标签。看起来正在发生的是,实际上正在改变的标签颜色与标签在下拉列表中的显示方式相反。例如,该列表包含文本标签:一,二,三,四,并按正确的顺序显示。我正在检查标签One,然后更改它的文本颜色。实际上最终发生的是四(从底部开始的第一项)的文本颜色实际上正在改变。如果我检查文本标签三,那么两(从底部起第三项)的文本颜色被改变。如果我检查标签文本四,一(从底部第四项)的文本颜色获取更改。此功能似乎适用于DropDownList中的每个项目。



有关如何解决此问题的任何建议,以便更改正确的文本颜色?



感谢您的帮助。

解决方案

在itemrenderer中使用dataChange事件处理程序并重置如果颜色不符合标准,则为正常标签颜色。如果符合条件,则更改为指定的颜色。


I have a Spark DropDownList that has a custom ItemRenderer. The ItemRenderer, upon creation, checks the label text and if it matches certain criteria, then the label text color changes. The label text color is changing, however it is for the wrong label. What appears to be happening is that the label color that is actually being changed is in reverse order of how the labels are displayed in the drop down list.

For example, the list contains the text labels: One, Two, Three, Four, and is being displayed in that exact order. I am checking for the label "One" and then changing it's text color. What actually ends up happening is that the text color for "Four" (first item from bottom) is actually being changed. If I check for the text label, "Three", then the text color for "Two" (third item from bottom) gets changed. If I check for the label text "Four", the text color for "One" (fourth item from bottom) gets changes. This functionality seems to hold true for each item in the DropDownList.

Any suggestions on how to resolve this issue so that the correct text color is being changed?

Thanks for the assistance.

解决方案

Use dataChange event handler in the itemrenderer and reset the color to the normal label color if it doesn't meet the criteria. If it does meet criteria, then change to the specified color.

这篇关于Spark DropDownList自定义ItemRenderer问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆