无法使用成功的 RemoteObject 调用的新分支刷新树控件
我正在尝试使用从 BlazeDS 获取的值填充 mx:tree 组件。从 BlazeDS 返回的数据很好 - 它是文件夹值对象的 ArrayCollection。
我被指示在这个项目中使用 Cairngorm。我对 Flex 和 Cairngorm 还很陌生。根据我在线阅读的有限文档,我应该用数据填充模型,因此我将数组集合放在那里。
我所坚持的是尝试更新树组件。我觉得我需要某种方法来通知树的容器组件数据(即子文件夹)在模型上可用。我希望能够在容器组件中触发一个函数,将子文件夹添加为所选节点的子节点(我猜我可以在远程对象调用之前将其放在模型上),然后触发 tree.invalidateList() 和树.validateNow()。有什么想法吗?
I'm trying to populate a mx:tree component with values that I'm getting from BlazeDS. The returned data from BlazeDS is fine - it's an ArrayCollection of Folder value objects.
I've been instructed to use Cairngorm for this project. I'm pretty new to Flex and Cairngorm. According to the limited documentation that I've read online I should populate the model with data so I've stuck the array collection there.
What I'm stuck with is trying to update the tree component. I feel that I need some way to notify the container component for the tree that the data (i.e. the subfolders) is available on the model. I was hoping that it would be possible to fire a function in the container component to add the subfolders as children of the selected node (I could chuck this on the model before the remote object call I guess) then fire tree.invalidateList() and tree.validateNow(). Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了一种方法来做到这一点,尽管我不确定这是否是推荐的方法。
我使用 Command 类将文件夹 VO 的 ArrayCollection 粘贴到模型上名为“子文件夹”的属性。我在树的父容器中使用 ChangeWatcher 来监视模型的“子文件夹”属性,并在需要时触发函数来更新树节点。
如果有人知道更好的方法,请告诉。我希望找到一本凯恩戈姆食谱或最佳实践文章,但我还没有偶然发现这样的事情。 Cairngorm 文档似乎相当稀疏 - 考虑到这一事实,我很惊讶它是最受欢迎的 Flex 框架。
I found a way to do this although I'm not sure if this is the recommended way.
I got the Command class to stick the ArrayCollection of Folder VOs to a property called 'subfolders' on the model. I used a ChangeWatcher in the tree's parent container to watch the model's 'subfolders' property and fire a function to update the tree node when required.
If someone knows of a better way, please tell. I was hoping to find a Cairngorm cookbook or best practices article but I've not stumbled upon such a thing yet. Cairngorm documentation seems pretty sparse - I'm surprised that it's the most popular Flex framework given this fact.