How do you constrain the elements of a开发者_高级运维 PanelPositioned so they can only be dragged within the current panel? I have two vertical lists of different data types, one above the other. Both use a PanelPositioned to allow drag & drop reordering, but the elements can be dragged up and down to the other panel, generating an error
<ice:panelPositioned id="dragPanel1" var="dataType1var"
value="#{displayBean.dataType1List}" constraint="vertical">
<ice:panelGroup style="cursor:move;">
</ice:panelGroup>
</ice:panelPositioned>
<ice:panelPositioned id="dragPanel2" var="dataType2var"
value="#{displayBean.dataType2List}" constraint="vertical">
<ice:panelGroup style="cursor:move;">
</ice:panelGroup>
</ice:panelPositioned>
For icefaces 3.0, add a beforeChangeListener
to the ice:panelPositioned
element. This listener should then call event.cancel()
if the event.getType() !=
to PanelPositionedEvent
.TYPE_MOVE
and the event.getIndex()
and event.getOldIndex()
are both greater than 1. If it is a move, then it is within panel. add/delete are moving between panels.
For icefaces 1.8.2 (neve used 2.0), you would need to add a listener to the ice:panelPositioned
element. There is no beforeChangeListener
. you will need a before list and current list (two copies). Both initialize to same elements when initializing backing bean. The listener, if a move - set before list to current list otherwise set current list to before list. Must be a copy, not a reference.
精彩评论