开发者

define a class implements ICollectionView, which can use as ComboBox or DataGrid's dataProvider(not build-in class)

开发者 https://www.devze.com 2023-01-11 23:50 出处:网络
recently, I research forthe collection framework, and find LinkedSet(AS3Commons collection framework,it is a good opensource framework) written in ActionScript, but it can\'t use as dataProvider in Co

recently, I research for the collection framework, and find LinkedSet(AS3Commons collection framework,it is a good opensource framework) written in ActionScript, but it can't use as dataProvider in ComboBox or DataGrid, because only implemen开发者_开发技巧ts ICollectionView can use as dataProvider. So I want to try if a class implements ICollectionView can work or not. I know Flex has build-in class implements ICollectionView, but I only want to define a class not use build-in class. The class as simple as possible.(can work is enough)


Call toArray on your LinkedSet and wrap it with mx.collections.ArrayCollection which implements ICollectionView, then hand that off to the ComboBox.

This works for any component that doesn't need to alter the underlying data structure. If you need to directly alter your Set via the controls, and copying to and from an Array isn't sufficent, you'll need to write your own implementation for ICollectionView and IViewCursor that wrap AS3CC's ICollection or whatever other class as you desire.

0

精彩评论

暂无评论...
验证码 换一张
取 消