You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Johan Haleby <jo...@gmail.com> on 2010/04/16 09:36:29 UTC
Failing to remove item from list when drag and dropping
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
--
View this message in context: http://n4.nabble.com/Failing-to-remove-item-from-list-when-drag-and-dropping-tp1960968p1960968.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Failing to remove item from list when drag and dropping
Posted by Johan Haleby <jo...@gmail.com>.
It works very well!! Thanks a lot for this, it's been extremely helpful!
/Johan
--
View this message in context: http://n4.nabble.com/Failing-to-remove-item-from-list-when-drag-and-dropping-tp1960968p2017437.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Failing to remove item from list when drag and dropping
Posted by Sven Meier <sv...@meiers.net>.
Hi Johan,
yes, works with 1.4.x and has an example project in the repository:
http://code.google.com/p/wicket-dnd/source/browse/#svn/trunk/wicket-dnd-examples
Regards
Sven
Johan Haleby wrote:
> Hi,
>
> Looks promising indeed. Does it work with Wicket 1.4.1? Do you have any code
> examples that I could have a look at?
>
> /Johan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Failing to remove item from list when drag and dropping
Posted by Johan Haleby <jo...@gmail.com>.
Hi,
Looks promising indeed. Does it work with Wicket 1.4.1? Do you have any code
examples that I could have a look at?
/Johan
--
View this message in context: http://n4.nabble.com/Failing-to-remove-item-from-list-when-drag-and-dropping-tp1960968p2013958.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Failing to remove item from list when drag and dropping
Posted by Sven Meier <sv...@meiers.net>.
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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org