Flex:从给定索引的 AdvancedDataGrid 获取项目
我有一个 AdvancedDataGrid 的子类,显示树状数据结构。 给定 calculateDropIndex
返回的索引,我如何获取该索引处的项目?
阅读大量代码后,似乎最不可怕的方法是:
var oldSelectedIndex:int = this.selectedIndex;
var mouseOverIndex:int = this.calculateDropIndex(event);
this.selectedItem = mouseOverIndex;
var item:* = this.selectedItem;
this.selectedIndex = oldSelectedIndex;
另一个选项似乎是在修改 iterator
属性...但是,从我看到它使用的方式来看,这也会很快变得非常哈利。
那么,如何才能在高级数据网格中的特定索引处获取项目而不发疯呢?
I've got a subclass of AdvancedDataGrid showing a tree-like data structure. How can I, given the index returned by calculateDropIndex
, get the item at that index?
After reading through reams of code, it seems like the least terrible way is:
var oldSelectedIndex:int = this.selectedIndex;
var mouseOverIndex:int = this.calculateDropIndex(event);
this.selectedItem = mouseOverIndex;
var item:* = this.selectedItem;
this.selectedIndex = oldSelectedIndex;
The other option seems to be tinkering around with the iterator
property... But, judging by the way I've seen it used, that will get pretty harry pretty quickly too.
So, how can I get the item at a particular index in an advanced datagrid without going insane?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以尝试:
You could try:
浏览文档,您似乎可以使用 openNodes,它返回所有打开节点的数组,它应该与您的索引相对应?
Looking through the docs, it seems you may be able to use openNodes, which returns an Array of all open nodes, which should correspond with your index?