Re: DOM element not found issue - Ajax response

2014-04-04 Thread Ernesto Reinaldo Barreiro
Hi,

Are you blocking the UI during AJAX requests? I have seen similar weird
things happening because:

1- One AJAX request (R1) is executing.
2- UI is not blocked. User click on on something. A second AJAX (R2)
request is queue: as far as I understand AJAX request are queued by channel
(please, Martin, correct me if I'm telling something wrong).
3- R1 completes and does some DOM replacements.
4- R1 is sent and after server response tries to do something on DOM but R1
already replaced that element.

Try blocking the UI.

On Fri, Apr 4, 2014 at 7:22 AM, Rakesh A iamrakes...@rediffmail.com wrote:

 Hi,

 In my case, the DOM element is not part of iframe/modal window, its in the
 current page itself. And the 'id' attribute used by javascript is also part
 of the same Ajax response. And I am using JQuery to reference this DOM
 element.
 What I am doing is.
 1. Go to my page
 2. Press F5 to refresh my wicket page [unversioned], and wait for the page
 to load completely.
 3. Click on one AjaxLink which replaces another component in the same page.

 Step#3 here responds markup and Javascript [JQuery script], I see that the
 'id' attribute used by JQuery is part of the same Ajax response. But still
 JQuery fails to find this DOM element.

 There is another case where I get similar issue.
 When my application is deployed over network, and is accessed from a
 different machine [with some network lag]. On the page I've one AjaxLink 
 and Component with Ajax on click behavior added to it.
 1. Click on component with ajax on click behavior.
 2. Click on AjaxLink, without waiting for the first request to complete.

 The AjaxLink in both scenarios is the same link, and replaced another
 component.

 Thanks,
 Rakesh.A

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/DOM-element-not-found-issue-Ajax-response-tp4665201p4665258.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




-- 
Regards - Ernesto Reinaldo Barreiro


Re: DOM element not found issue - Ajax response

2014-04-04 Thread Ernesto Reinaldo Barreiro
on 4- R1 is sent R2 is sent


On Fri, Apr 4, 2014 at 8:33 AM, Ernesto Reinaldo Barreiro 
reier...@gmail.com wrote:

 Hi,

 Are you blocking the UI during AJAX requests? I have seen similar weird
 things happening because:

 1- One AJAX request (R1) is executing.
 2- UI is not blocked. User click on on something. A second AJAX (R2)
 request is queue: as far as I understand AJAX request are queued by channel
 (please, Martin, correct me if I'm telling something wrong).
 3- R1 completes and does some DOM replacements.
 4- R1 is sent and after server response tries to do something on DOM but
 R1 already replaced that element.

 Try blocking the UI.

 On Fri, Apr 4, 2014 at 7:22 AM, Rakesh A iamrakes...@rediffmail.comwrote:

 Hi,

 In my case, the DOM element is not part of iframe/modal window, its in the
 current page itself. And the 'id' attribute used by javascript is also
 part
 of the same Ajax response. And I am using JQuery to reference this DOM
 element.
 What I am doing is.
 1. Go to my page
 2. Press F5 to refresh my wicket page [unversioned], and wait for the page
 to load completely.
 3. Click on one AjaxLink which replaces another component in the same
 page.

 Step#3 here responds markup and Javascript [JQuery script], I see that the
 'id' attribute used by JQuery is part of the same Ajax response. But still
 JQuery fails to find this DOM element.

 There is another case where I get similar issue.
 When my application is deployed over network, and is accessed from a
 different machine [with some network lag]. On the page I've one AjaxLink 
 and Component with Ajax on click behavior added to it.
 1. Click on component with ajax on click behavior.
 2. Click on AjaxLink, without waiting for the first request to complete.

 The AjaxLink in both scenarios is the same link, and replaced another
 component.

 Thanks,
 Rakesh.A

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/DOM-element-not-found-issue-Ajax-response-tp4665201p4665258.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




 --
 Regards - Ernesto Reinaldo Barreiro




-- 
Regards - Ernesto Reinaldo Barreiro


Re: DOM element not found issue - Ajax response

2014-04-04 Thread Martin Grigorov
On Fri, Apr 4, 2014 at 8:33 AM, Ernesto Reinaldo Barreiro 
reier...@gmail.com wrote:

 Hi,

 Are you blocking the UI during AJAX requests? I have seen similar weird
 things happening because:

 1- One AJAX request (R1) is executing.
 2- UI is not blocked. User click on on something. A second AJAX (R2)
 request is queue: as far as I understand AJAX request are queued by channel
 (please, Martin, correct me if I'm telling something wrong).


You are correct, Ernesto ! :)
By default all Ajax calls use the same channel name (0) and type (queue).
You can control this by using custom AjaxChannel -
AjaxRequestAttributes#setChannel().


 3- R1 completes and does some DOM replacements.
 4- R1 is sent and after server response tries to do something on DOM but R1
 already replaced that element.

 Try blocking the UI.

 On Fri, Apr 4, 2014 at 7:22 AM, Rakesh A iamrakes...@rediffmail.com
 wrote:

  Hi,
 
  In my case, the DOM element is not part of iframe/modal window, its in
 the
  current page itself. And the 'id' attribute used by javascript is also
 part
  of the same Ajax response. And I am using JQuery to reference this DOM
  element.
  What I am doing is.
  1. Go to my page
  2. Press F5 to refresh my wicket page [unversioned], and wait for the
 page
  to load completely.
  3. Click on one AjaxLink which replaces another component in the same
 page.
 
  Step#3 here responds markup and Javascript [JQuery script], I see that
 the
  'id' attribute used by JQuery is part of the same Ajax response. But
 still
  JQuery fails to find this DOM element.
 
  There is another case where I get similar issue.
  When my application is deployed over network, and is accessed from a
  different machine [with some network lag]. On the page I've one AjaxLink
 
  and Component with Ajax on click behavior added to it.
  1. Click on component with ajax on click behavior.
  2. Click on AjaxLink, without waiting for the first request to complete.
 
  The AjaxLink in both scenarios is the same link, and replaced another
  component.
 
  Thanks,
  Rakesh.A
 
  --
  View this message in context:
 
 http://apache-wicket.1842946.n4.nabble.com/DOM-element-not-found-issue-Ajax-response-tp4665201p4665258.html
  Sent from the Users forum mailing list archive at Nabble.com.
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 


 --
 Regards - Ernesto Reinaldo Barreiro



Re: DOM element not found issue - Ajax response

2014-04-03 Thread Rakesh A
Hi,

In my case, the DOM element is not part of iframe/modal window, its in the
current page itself. And the 'id' attribute used by javascript is also part
of the same Ajax response. And I am using JQuery to reference this DOM
element.
What I am doing is.
1. Go to my page
2. Press F5 to refresh my wicket page [unversioned], and wait for the page
to load completely.
3. Click on one AjaxLink which replaces another component in the same page.

Step#3 here responds markup and Javascript [JQuery script], I see that the
'id' attribute used by JQuery is part of the same Ajax response. But still
JQuery fails to find this DOM element.

There is another case where I get similar issue.
When my application is deployed over network, and is accessed from a
different machine [with some network lag]. On the page I've one AjaxLink 
and Component with Ajax on click behavior added to it.
1. Click on component with ajax on click behavior.
2. Click on AjaxLink, without waiting for the first request to complete.

The AjaxLink in both scenarios is the same link, and replaced another
component.

Thanks,
Rakesh.A

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/DOM-element-not-found-issue-Ajax-response-tp4665201p4665258.html
Sent from the Users forum mailing list archive at Nabble.com.

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



DOM element not found issue - Ajax response

2014-04-01 Thread Rakesh A
Hi,

I am using Wicket v6.12.0, I've couple of Ajax links, clicking on which will
replace a panel [ajax enabled - markup id is generated], and this click also
results a piece of javascript, which will use the markup id of the panel.
In some cases I see the the javascript fails saying the DOM element doesn't
exists. When I enable Ajax debug window and see the response, I do see the
panel with markup id and the javascript is using the same markup id, but
still script fails to find the DOM element.

This script is added using OnDomReadyHeaderItem. Can anyone point me how to
find the cause of it?

Thanks,
Rakesh.A

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/DOM-element-not-found-issue-Ajax-response-tp4665201.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: DOM element not found issue - Ajax response

2014-04-01 Thread Martin Grigorov
Hi,

It sounds like the old HTML element (the one to be replaced) is not there
or has a different markup id.

Another possibility is that the old element is in different document, e.g.
when ModalWindow with a Page is used the page's markup is put in an iframe
and any JS contributed by OnDomReadyHeaderItem that tries to find an HTML
element from the main page will fail. In this case you need to use
document.top.getElementById(theId) to be able to find it.

Martin Grigorov
Wicket Training and Consulting


On Tue, Apr 1, 2014 at 2:11 PM, Rakesh A iamrakes...@rediffmail.com wrote:

 Hi,

 I am using Wicket v6.12.0, I've couple of Ajax links, clicking on which
 will
 replace a panel [ajax enabled - markup id is generated], and this click
 also
 results a piece of javascript, which will use the markup id of the panel.
 In some cases I see the the javascript fails saying the DOM element doesn't
 exists. When I enable Ajax debug window and see the response, I do see the
 panel with markup id and the javascript is using the same markup id, but
 still script fails to find the DOM element.

 This script is added using OnDomReadyHeaderItem. Can anyone point me how to
 find the cause of it?

 Thanks,
 Rakesh.A

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/DOM-element-not-found-issue-Ajax-response-tp4665201.html
 Sent from the Users forum mailing list archive at Nabble.com.

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