I can't reproduce this error. It works form e. Take a look into trunk. In the 
Example, the DraggableElement (draggable1) is now a panel with some draggable 
element inside. The whole panel gets replaced if you klick on the "AjaxLink". 
Dragging still works after the replacement.

You can respond to my email address directly. I don't thik we need to flood the 
list with this special case.

And if your native language sould be german...

Stefan

-----Ursprüngliche Nachricht-----
Von: Stefan Jozsa [mailto:stefan_...@yahoo.com] 
Gesendet: Donnerstag, 18. Juni 2009 16:45
An: users@wicket.apache.org
Betreff: RE: WicketJQuery: Drag & drop behavior lost for components of AJAX 
updated panels


Yes, that is, you right !

Having:
   Panel myPanel = new MyPanel("panelId");

depending how is "rendered" by 
1. addOrReplace(myPanel) in a page constructor or by
2. target.addComponent(myPanel) in an event callback method

the result is different !
Stefan


--- On Thu, 6/18/09, Stefan Lindner <lind...@visionet.de> wrote:

> From: Stefan Lindner <lind...@visionet.de>
> Subject: RE: WicketJQuery: Drag & drop behavior lost for components of AJAX 
> updated panels
> To: users@wicket.apache.org
> Date: Thursday, June 18, 2009, 5:39 PM
> Do I understand you right, you have
> something like
> 
>     Class MyPanel {
>        public MyPanel(...) {
>           Component c = new
> Component(...);
>           c.add(new Draggable());
>           // some more components
> with draggable
>        }
>     }
> 
> 
> 
>     MyPage extends WebPage {
>       Public MyPage() {
>          add(new
> MyPanel(...));
>          // dragging works
> 
>          add(new
> AjaxLink(...){
>            
> onClick(AjaxRequestTarget) {
>            
>    MyPanel newPanel;
>            
>    getPage.addOrReplace(newPanel = new
> MyPanel(...));
>            
>    target.addComponent(newPanel);
>            
>    // Dragging stops working
>             }
>          });
>       }
>     }
> Right?
> 
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: Stefan Jozsa [mailto:stefan_...@yahoo.com]
> 
> Gesendet: Donnerstag, 18. Juni 2009 16:28
> An: users@wicket.apache.org
> Betreff: RE: WicketJQuery: Drag & drop behavior lost
> for components of AJAX updated panels
> 
> 
> Hi Stefan,
> 
> Sorry, but I missed to specify that DraggableBehavior is
> added to
> (undefined/variable number of) components of 'MyPanel',
> that is
> not to the panel itself.
> So, using the same 'MyPanel' constructor in both cases 
> DraggableBehavior is added (by Java code) to those
> components of 'MyPanel'.
> 
> Having: 
>    Panel myPanel = new MyPanel("panelId");
> depending how is "rendered" by addOrReplace(myPanel) or by
> target.addComponent(myPanel) the result is different, 
> the markup (and who knows what...) is different.
> 
> I tried WicketJQuery-0.3.5, got same (draggable behavior
> lost) result.
> 
> I tried even (naive) workarounds like:
>   myDraggableComponent.add(new
> AttributeModifier("class", true, new
> Model<String>("ui-draggable")));
>   myDraggableComponent.add(new
> AttributeModifier("dragclass", true, new
> Model<String>("a")));
> but got the same (draggable behavior lost) result.
> 
> This is extremly disturbing issue since cannot reload page
> (it has an embedded Flash player) and GUI interaction is
> based on
> AJAX backed panel/component refresh.
> 
> Any idea, help, workaround, fix is welcomed,
> thanks,
> Stefan
> 
> 
> --- On Thu, 6/18/09, Stefan Lindner <lind...@visionet.de>
> wrote:
> 
> > From: Stefan Lindner <lind...@visionet.de>
> > Subject: RE: WicketJQuery: Drag & drop behavior
> lost for components of AJAX updated panels
> > To: users@wicket.apache.org
> > Date: Thursday, June 18, 2009, 3:30 PM
> > I can't see a solution for what you
> > are doing.
> > 
> >     ...
> >     @Override
> >     public void onClick(AjaxRequestTarget target)
> > {
> >         Panel panel = new
> > MyPanel("panelId");
> >         addOrReplace(panel);
> >         target.addComponent(panel);
> >     }
> > 
> > creates a NEW Panel and the NEW panel is a totally
> new
> > object that does not know anything about the ORIGINAL
> Panel.
> > The AJAX response renders the NEW Panel (with it's new
> class
> > attribute but without the AJAX behaviors you've added
> to the
> > ORIGINAL Panel).
> > 
> > This also happens with Wickts builtin Behaviors. Try
> this
> > 
> >         panel.add(new
> > AjaxEventBehavior("onclick") {
> >            
> > @Override
> >            
> > protected void onEvent(AjaxRequestTarget target) {
> >            
> >     System.out.println("clicked!");
> >             }
> >         });
> > 
> > This also disappears after you replace the panel
> within an
> > AJAX call.
> > 
> > 
> > You can do two things:
> > 1.  ...
> >     @Override
> >     public void onClick(AjaxRequestTarget target)
> > {
> >         Panel panel = new
> > MyPanel("panelId");
> > !       panel.add(new
> > DraggableBehavior());
> >         addOrReplace(panel);
> >         target.addComponent(panel);
> >     }
> > 
> > !   AND USE VERSION 0.3.5!
> > 
> > 2.  ...
> >     @Override
> >     public void onClick(AjaxRequestTarget target)
> > {
> > !   
> >    originalPanel.setDefaultModelObject(some
> > new value);
> > !   
> >    target.addComponent(originalPanel);
> >     }
> > 
> > Good luck and let me know if it works for you!
> > 
> > Stefan
> > 
> > -----Ursprüngliche Nachricht-----
> > Von: Stefan Jozsa [mailto:stefan_...@yahoo.com]
> > 
> > Gesendet: Donnerstag, 18. Juni 2009 13:24
> > An: users@wicket.apache.org
> > Betreff: Re: WicketJQuery: Drag & drop behavior
> lost
> > for components of AJAX updated panels
> > 
> > 
> > Found that when panel is constructed like:
> >     public MyPage() {
> >         ...
> >         add(new MyPanel("panelId"));
> >         ...
> >     }
> > markup of a draggable element is:
> > <span id="id123456" class="myClass ui-draggable"
> ...
> > >[]</span>
> > 
> > However when:
> >     ...
> >     @Override
> >     public void onClick(AjaxRequestTarget target)
> > {
> >         Panel panel = new
> > MyPanel("panelId");
> >         addOrReplace(panel);
> >         target.addComponent(panel);
> >     }
> > markup of a draggable element is:
> > <span id="id123456" class="myClass" ...
> > >[]</span>
> > 
> > that is 'ui-draggable' is not found (stripped ? not
> added?)
> > 
> > in 'class' attribute of draggable element.
> > 
> > Any help is welcommed,
> > Stefan
> > 
> > 
> > --- On Thu, 6/18/09, Stefan Jozsa <stefan_...@yahoo.com>
> > wrote:
> > 
> > > From: Stefan Jozsa <stefan_...@yahoo.com>
> > > Subject: WicketJQuery: Drag & drop behavior
> lost
> > for components of AJAX updated panels
> > > To: users@wicket.apache.org
> > > Date: Thursday, June 18, 2009, 1:44 PM
> > > 
> > > Doing:
> > >     public MyPage() {
> > >         ...
> > >         add(new MyPanel("panelId"));
> > >         ...
> > >     }
> > > dragging elements (having DraggableBehavior) of
> > 'MyPanel'
> > > works.
> > > 
> > > However doing:
> > >     ...
> > >     @Override
> > >     public void onClick(AjaxRequestTarget
> target)
> > > {
> > >         Panel panel = new
> > > MyPanel("panelId");
> > >         addOrReplace(panel);
> > >         target.addComponent(panel);
> > >     }
> > >     
> > > dragging elements of 'MyPanel' DO NOT works
> > > (DraggableBehavior is lost).
> > > 
> > > 
> > > What's going on ?
> > > Any help is (very) appreciated,
> > > thanks Stefan
> > > 
> > > Using:
> > > Wicket-1.4.rc4,
> > > WicketJQuery-0.3.4
> > > 
> > > 
> > > 
> > > 
> > >       
> > > 
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > > For additional commands, e-mail: users-h...@wicket.apache.org
> > > 
> > > 
> > 
> > 
> >       
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> > 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> > 
> > 
> 
> 
>       
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 


      

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


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

Reply via email to