如何删除组合框中已选择的项目
我遇到了组合框重复的问题 我有 10 个自动完成组合框,它们都具有相同的数据提供者... 假设像这个数组集合一样,
public var costCenter:ArrayCollection = new
ArrayCollection(["1101","1111","1121","1131","1141","1151",
"1161","1171","1181","1191"]);
如果使用 1131 选择第一个组合框,那么它不应该出现在下一个组合框数据提供程序中。 已选择的项目应从数据提供者的集合中删除 用户可以选择 10 个组合框中的第一个
来制作集合的副本,并使用该集合作为所有组合框的数据提供者。 如何从集合中删除已选择的项目? 有什么想法吗? 谢谢。
Am having an issue with combobox duplications
i have 10 autocomplete comboboxes with all having same dataprovider...
suppose like this array collection
public var costCenter:ArrayCollection = new
ArrayCollection(["1101","1111","1121","1131","1141","1151",
"1161","1171","1181","1191"]);
if 1st combobox is selected with 1131 then that shouldnt be there in next comboboxes dataprovider.
that is already selected items should be removed from collection for dataprovider
and user can select 1st any of the 10 comboboxes
am making a copy of collection and using that collection as dataprovider for all comboboxes..
how to remove the already selected items from collection?
any ideas?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
filterFunction
在您的ArrayCollection
实例上,并在选择值后对其调用refresh()
。但所有集合都应该是来自作为源的单个Array
的不同实例。You can use
filterFunction
on youArrayCollection
instances and callrefresh()
on them after selecting values. But all the collections should be different instances from the singleArray
as a source.最好的方法是从 selectedIndices 中删除项目,如果您使用的是 3.x 版本,那么您可以执行类似
comboBox.selectedIndex = -1
的操作,但在 4.x 中您必须这样做执行类似comboBox.selectedIndices = new Vector.()
的操作。The best way to do it is to remove the items from selectedIndices if you are doing version 3.x then you can just do something like
comboBox.selectedIndex = -1
, but in 4.x you have to do something likecomboBox.selectedIndices = new Vector.<int>()
.