You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by denethon <to...@hotmail.com> on 2014/06/02 13:06:01 UTC

Remember Wicket.Ajax.ajax bindings after altering DOM with javascript.

Hi

I'm in the process of updating a wicket application from wicket 1.5 to
wicket 6, and have come across a challenge regarding third party javascript
code altering the DOM after markup has been sent to the client.

Basically there are several <section> elements in the markup who are
distributed evenly across a number of <div class="column"> when the user
resize the browser window. The steps are as follows:

1. Fetch all section elements HTML and put them inside an array (as a
string).
2. Calculate number of columns based on the size of surrounding div.
3. Create the desired number of columns
4. Distribute the sections elements (or html really) evenly across the
columns.

This is done every time the user alters the size of the browser window,
possibly causing the DOM to change if the number of columns increases or
decreases.

By doing this, the elements being moved around seems to loose its wicket
Wicket.Ajax.ajax-bindings like the one below.

Wicket.Ajax.ajax({"u":"./org.package.SomePage?16-1.IBehaviorListener.0-listItemsDiv-listItemRepeater-1-
somePanel-someAjaxLink","e":"click","c":"ajaxlinkID"});;

Is there any way to make wicket stick the ajax behavior to the section
elements, so that when moving the sections around across the columns the
ajax-bindings wont be broken?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Remember-Wicket-Ajax-ajax-bindings-after-altering-DOM-with-javascript-tp4666091.html
Sent from the Users forum 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: Remember Wicket.Ajax.ajax bindings after altering DOM with javascript.

Posted by Martin Grigorov <mg...@apache.org>.
This is how we work here! ;)
Have fun!

Martin Grigorov
Wicket Training and Consulting


On Mon, Jun 2, 2014 at 2:01 PM, denethon <to...@hotmail.com> wrote:

> Using clone(true, true) solved it! Thank you for your fast response :-)
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Remember-Wicket-Ajax-ajax-bindings-after-altering-DOM-with-javascript-tp4666091p4666095.html
> Sent from the Users forum 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: Remember Wicket.Ajax.ajax bindings after altering DOM with javascript.

Posted by denethon <to...@hotmail.com>.
Using clone(true, true) solved it! Thank you for your fast response :-)

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Remember-Wicket-Ajax-ajax-bindings-after-altering-DOM-with-javascript-tp4666091p4666095.html
Sent from the Users forum 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: Remember Wicket.Ajax.ajax bindings after altering DOM with javascript.

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

How do you "move" the HTML element with id "ajaxLinkID" ?
I think you can use jQuery#clone(true, true) to preserve the event bindings
of the original HTML element.

Martin Grigorov
Wicket Training and Consulting


On Mon, Jun 2, 2014 at 1:06 PM, denethon <to...@hotmail.com> wrote:

> Hi
>
> I'm in the process of updating a wicket application from wicket 1.5 to
> wicket 6, and have come across a challenge regarding third party javascript
> code altering the DOM after markup has been sent to the client.
>
> Basically there are several <section> elements in the markup who are
> distributed evenly across a number of <div class="column"> when the user
> resize the browser window. The steps are as follows:
>
> 1. Fetch all section elements HTML and put them inside an array (as a
> string).
> 2. Calculate number of columns based on the size of surrounding div.
> 3. Create the desired number of columns
> 4. Distribute the sections elements (or html really) evenly across the
> columns.
>
> This is done every time the user alters the size of the browser window,
> possibly causing the DOM to change if the number of columns increases or
> decreases.
>
> By doing this, the elements being moved around seems to loose its wicket
> Wicket.Ajax.ajax-bindings like the one below.
>
>
> Wicket.Ajax.ajax({"u":"./org.package.SomePage?16-1.IBehaviorListener.0-listItemsDiv-listItemRepeater-1-
> somePanel-someAjaxLink","e":"click","c":"ajaxlinkID"});;
>
> Is there any way to make wicket stick the ajax behavior to the section
> elements, so that when moving the sections around across the columns the
> ajax-bindings wont be broken?
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Remember-Wicket-Ajax-ajax-bindings-after-altering-DOM-with-javascript-tp4666091.html
> Sent from the Users forum 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
>
>