Flex 4 List - 拖放问题
我有两个不同的 Spark Lists
,有两个不同的 ItemRenderer
,其中一个带有 dragEnabled="true"
,另一个带有 dropEnabled ="true"
,这样每当我从一个列表拖放到另一个列表中时,就会创建所删除对象的副本并将其插入到第二个列表的 dataProvider 中。
<s:List id="source"
itemRenderer="componentsRenderers.SourceItemRenderer"
dragEnabled="true"
dataProvider="{elements}"/>
<s:List id="destination"
itemRenderer="componentsRenderers.DestinationItemRenderer"
dragEnabled="false"
dropEnabled="true"
change="destinationChanged(event)"/>
事件处理程序 destinationChanged()
是一种方法,用于解析最近添加的对象、将其删除并创建一个新对象,该新对象除其他外,还具有一个 UIComponent
,该对象必须被渲染。
这个洞的东西工作得很好,除了一件事:一旦我加载应用程序,要放到 destination
中的第一个项目的 UIComponent
就永远不会获得渲染器。完整的对象就在那里,并且与其相关的所有其他功能都可以工作,但组件不会被渲染。如果我删除该对象,使列表再次为空,然后再次插入它,它就会被渲染!
另外,插入“不可见”的插入后,以下所有插入都将起作用。
有想法吗? 谢谢!
Update: I just found out that the itemRenderer
DestinationItemRenderer
gets rendered twice for the first element to be dropped.I have two different Spark Lists
, with two different ItemRenderers
, one of them with dragEnabled="true"
and the other with dropEnabled="true"
, in such a way that whenever I drag from one and drop in the other, a copy of the object dropped is created and inserted in the second List's dataProvider.
<s:List id="source"
itemRenderer="componentsRenderers.SourceItemRenderer"
dragEnabled="true"
dataProvider="{elements}"/>
<s:List id="destination"
itemRenderer="componentsRenderers.DestinationItemRenderer"
dragEnabled="false"
dropEnabled="true"
change="destinationChanged(event)"/>
The event handler destinationChanged()
is a method that parses the recently added object, removes it, and creates a new one that, among other stuff, has an UIComponent
that has to be rendered.
The hole thing works well, except by one thing: as soon as the I load the application, the UIComponent
of the first item to be dropped in destination
never gets renderer. The full object is there and all the other functionalities related to it work, but the component doesn't get rendered. If I delete the object, making the List empty again, and insert it again, it gets rendered!
Also, after inserting the 'invisible' one, all the following inserts works.
Ideas?
Thanks!
Update: I just found out that the itemRenderer
DestinationItemRenderer
gets rendered twice for the first element to be dropped.如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论