-
FEATURED COMPONENTS
First time here? Check out the FAQ!
HI, all:
我需要一个拖放效果在我的项目中。 我参考了ZK官网的demo- http://www.zkoss.org/zkdemo/effects/drag_n_drop
我大概明白其中的工作原理。容器(demo中的listbox)的onDrop事件被触发时,它添加dragged作为自己的child,这个
好理解,那么,在listitem的onDrop事件发生时,调用的insertBefore是什么意思?移动源的item是怎么消失的?谁调用
了remove的方法?
Here is the code in the demo:
void move(Component dragged) { if (self instanceof Listitem) { self.parent.insertBefore(dragged, self); } else { self.appendChild(dragged); } }
self.parent. insertBefore(dragged, self) means inserting the "dragged" before "self" as a child of ("self.parent")
Once you move the item to be a child of another component, it is automatically detached from its original parent
Asked: 2012-09-17 10:55:41 +0800
Seen: 79 times
Last updated: Sep 18 '12