如何在flex4下拉列表中保留提示/虚拟项目
我有一个“选择员工”的下拉列表,这是可选的。我需要它在顶部有“No one”,这样如果用户已经选择了“John Something”,他就可以改回NoOne。
我的问题是如何保留提示项,或在 -1 处添加虚拟项而不更改数据提供者(我真的很讨厌在原始的雇员列表数据提供者中添加“没有人”)
P/S:同样的问题但仍然没有答案:
I have a dropdownlist of "Select an employee" which is optional. I need it to have "No one" at the top so that user can change back to NoOne if he' ve already chosen "John Someone".
My question is how to keep the prompt item, or add a dummy item at -1 without changing the dataprovider (I really hate adding "No one" to the original employeeList dataprovider)
P/S: same questions but still no answer:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我建议通过创建一个名为“DummyArrayCollection”的类来扩展 ArrayCollection 类。您可以将虚拟变量存储在那里并将其用作数据提供者,而不会影响原始员工列表:
I would recommend extending the ArrayCollection class by creating a class called "DummyArrayCollection." You can store your dummy variable there and use this as a dataprovider without affecting the original list of employees:
将更改事件处理程序添加到下拉列表中:
change = "{myDropDown.selectedIndex = -1}"
这样,您的提示将在选择项目后重复使用。
Add a change event handler to your drop down list:
change = "{myDropDown.selectedIndex = -1}"
this way your prompt will be reused after item was selected.
以防万一有人感兴趣,我刚刚发现了这个:
收据
Just in case somebody was interested I had just found this:
Receipt
这是一个工作的 Flex 3 示例。我确信它可以很容易地转换为 flex 4。
Here is a working flex 3 example. I am sure it can be converted to flex 4 easy enough.
dropDownList.selectedItem=null
dropDownList.selectedItem=null