Spark DropDownList Custom ItemRenderer Issue

浪尽此生 提交于 2019-12-24 04:08:32

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/2540821/spark-dropdownlist-custom-itemrenderer-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!