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

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

问题描述

我有一个带有自定义 ItemRenderer 的 Spark DropDownList.ItemRenderer 在创建时会检查标签文本,如果它符合特定条件,则标签文本颜色会发生变化.标签文本颜色正在改变,但它用于错误的标签.看起来正在发生的事情是实际更改的标签颜色与标签在下拉列表中的显示顺序相反.

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.

例如,该列表包含文本标签:一、二、三、四,并按该确切顺序显示.我正在检查标签一",然后更改它的文本颜色.实际上最终发生的是四"(从底部开始的第一项)的文本颜色实际上正在改变.如果我检查文本标签三",则二"(从底部算起的第三项)的文本颜色会更改.如果我检查标签文本四",一"(底部第四项)的文本颜色会发生变化.此功能似乎适用于 DropDownList 中的每个项目.

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?

感谢您的帮助.

推荐答案

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

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天全站免登陆