Flex 3 高级数据网格分组
有没有办法将未分组和分组的项目混合在同一个数据网格中? 例如,考虑一个列出 C:\ 驱动器上的根项目的网格。
显然,我们希望目录结构是分组且可扩展的。但是根驱动器上的文件也会显示在列表中,但它们不会被分组。
有没有办法处理这种情况?有人有可用的例子吗?
Is there a way to have ungrouped and grouped items mixed in the same datagrid?
For example, think of a grid that lists the root items on a C:\ drive.
Obviously, we would want the Directory Structure to be group and expandable. But the files on the root drive would also be shown on the list, however they would not be grouped.
Is there an idea way to handle this situation? Does anyone have any examples available?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将 AdvancedDataGrid 与
HierarchicalData
(另一个链接)应该可以让您您正在寻找的功能。Using the AdvancedDataGrid with
HierarchicalData
(another link) should get you the functionality you're looking for.您将类型转换为 HierarchicalData 的 dataProvider(例如 ArrayCollection)应该是以下结构的对象集合。
{column1Data:"",column2Data:"",column3Data:""...columnNData:"",categories:arr}
其中 arr 是相同结构的另一个 ArrayCollection ,即
{column1Data:"",...columnNData:"",categories:arr1}
和 arr1 再次具有相同的结构。如果您有 N 级向下钻取,则可以一直持续到 arrN 。
那些仅代表一层数据(或如您所说的未分组数据)的对象将不具有“类别”属性。
your dataProvider(say an ArrayCollection) which you will typecast to HierarchicalData should be a collection of objects of the following structure.
{column1Data:"",column2Data:"",column3Data:""...columnNData:"",categories:arr}
where arr is another ArrayCollection of the same structure ie
{column1Data:"",...columnNData:"",categories:arr1}
and arr1 again of the same structure.this can go on till arrN ,if you have N level drilldown.
Those objects which represent only one level of data(or ungrouped data as you say) will not have the "categories" attribute.