Hi Johan,

seems to me http://code.google.com/p/wicket-dnd/ supports everything you need without any hacking.

Regards

Sven

Johan Haleby wrote:
Hi,
I have a use case that reads as follows: I need two lists next to each
other. When starting up the left list is empty and I add items to it by
dragging them from the right list and dropping them on the left. These items
should be copied, (i.e. _not_ moved, the right list should be static) from
the right list into the selected position in the left list. It should also
be possible to reorder the items in the left list using drag and drop. The
last thing is that you should be able to remove items from the left list by
dragging and dropping them back to the right list. Since the right list is
"static" the item should _not_ be added to the right list but rather just
removed from the left list.
After some investigation I've settled on using the YuiDDListView (from the
wicket-yui project) which  extends from a standard Wicket ListView. I've
chosen this component since it supports positioning items in the list (i.e.
you know to which index you dropped the item in the list). After MUCH
hacking around I've managed to get most things working. There are mainly two
things left and here I would really appreciate some help:
1) I cannot seem to remove _the last_ item in the left list (i.e. by drag
and dropping to the right list). It works fine for all other items but for
the last item it fails saying e.g.:
Caused by: org.apache.wicket.WicketRuntimeException: component
tabs:panel:panel:list:items:0 not found on page
com.mycompany.MyPageCompany[id = 4], listener interface =
[RequestListenerInterface name=IBehaviorListener, method=public abstract
void org.apache.wicket.behavior.IBehaviorListener.onRequest()] at org.apache.wicket.request.AbstractRequestCycleProcessor.resolveListenerInterfaceTarget(AbstractRequestCycleProcessor.java:426) at org.apache.wicket.request.AbstractRequestCycleProcessor.resolveRenderedPage(AbstractRequestCycleProcessor.java:471) at org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequestCycleProcessor.java:144) ... 28 more
What causes this is that in the onDrop method in the left list I remove the
dropped item from the list if it's dropped on the right list. Why is this
happening? What's the best way to resolve it?
2) When I drag and item from the left to the right it looks like the item is
added to the right list until I reload the page. I figure could be a
javascript error since the javascript doesn't understand that the item
shouldn't be added to the right list at all (it should instead be removed
from the left list). What would be the best way to resolve this? I'm using Wicket 1.4.1.
/Johan


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to