为什么我的 listCollectionView 不显示添加到基础列表(在 Flex 中)的新项目?
我有一个(空)ArrayCollection,我用 ListCollectionView 包装它。 然后我向 ArrayCollection 添加一系列项目,但这些项目没有显示在视图中。
public var transactions : ArrayCollection = new ArrayCollection();
public var filteredTransactions : ListCollectionView = new ListCollectionView(transactions);
transactions
包含 150 个项目,filteredTransactions
不包含任何项目。我最初以为这是我正在应用的过滤器,但即使删除过滤器,我仍然在过滤列表中没有得到任何项目。
我是不是漏掉了一步? 我是否需要将项目以及底层集合添加到视图中(但这似乎违背了使用视图的目的......)?
I have an (empty) ArrayCollection that I wrap with a ListCollectionView.
Then I add a series of items to the ArrayCollection, but these are not showing up in the view.
public var transactions : ArrayCollection = new ArrayCollection();
public var filteredTransactions : ListCollectionView = new ListCollectionView(transactions);
transactions
contains 150 items, filteredTransactions
contains none. I originally thought it was the filter I was applying, but even when I remove the filter, I still get no items in the filtered list.
Have I missed a step?
Do I need to add the items to the view as well as the underlying collection (this would seem to defeat the purpose of using a view though...)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您不使用 addAll、addItem 或 addItemAt 将项目放入 ArrayCollection,请首先尝试将其作为解决方案。将项目直接添加到 ArrayCollection 包装的数组中不会调度 CollectionEvents。
另外,在将ListCollectionView 的list 属性设置为ArrayCollection 后,尝试使用ListCollectionView 的refresh() 方法。
如果这些解决方案都不起作用,那么请发布额外的代码。
If you aren't using addAll, addItem, or addItemAt to put items in the ArrayCollection, try that as a solution first. Adding items directly to the Array that the ArrayCollection wraps will not dispatch CollectionEvents.
Also, try to use the ListCollectionView's refresh() method after setting its list property to the ArrayCollection.
If neither of these solutions work then please post additional code.