0

I need to add a sibling to certain HTML elements in the Vaadin application. I don't want to do this on the server side, because it's far too complicated in my case.

I wrote a javascript, that does the magic and it is executed after the page loads the first time. But then, when I click a certain button, some of the elements are loaded from backend using AJAX by Vaadin.

I subscribe for this button "click" event in the javascript. In the listener function I want to wait until Vaadin completes the request and makes the changes in the DOM. Then, I would run my function again.

Question is - how to detect when Vaadin completes its request? Setting timeout is not an answer for me.

Filburt
  • 17,626
  • 12
  • 64
  • 115
fracz
  • 20,536
  • 18
  • 103
  • 149

1 Answers1

0

Most AJAX library/routine provides you a callback when the AJAX is done. So basically you can set a flag before you start AJAX callback, and then call that flag when your callback is called. At other places you can then check that flag to see if your AJAX call has come back yet.

Some other AJAX library already does that for you and has something like "isInProgress()" that you can simply check anytime to see if it is has come back yet.

user3015039
  • 161
  • 2
  • This is not a case in Vaadin. I could not find any API for checking status neither in Vaadin docs nor by debugging. – fracz Nov 20 '13 at 22:19