Re: Dom change propagation time
I've run into similar issues adding a style name to a widget and then immediately trying to read the class attribute of the element. I think that the issue is that while JS is single-threaded, the browser itself isn't required to be, and the effect of some JS statements can take time to complete within the browser's native code, even though the JS method returned immediately.
Try Scheduler.scheduleDeferred, which runs your code with a minimal timeout (basically what you did yourself -- your code should also work if you make the timeout just 1 millisecond).
On Monday, August 12, 2013 9:55:29 AM UTC-4, asif...@gmail.com wrote:
-- Try Scheduler.scheduleDeferred, which runs your code with a minimal timeout (basically what you did yourself -- your code should also work if you make the timeout just 1 millisecond).
On Monday, August 12, 2013 9:55:29 AM UTC-4, asif...@gmail.com wrote:
Hi ,
I am changing the id of an element in the dom with
tableeditor.getElement().setId("tableeditor");
where
@UiField
SimplePanel tableeditor;
After this I call a javascript which manipulates the dom based on the id=tableeditor.
However, if I put a timeout of 1 sec after changing the dom id property, the javascript works fine.
IF I call the javascript immediately after the setId call, then two things happen
1>. The id is not set.
2>. The javascript throws an exception since it is expecting the id to be present.
What is the reason of this behaviour?
I would prefer not putting a timer, unless there is no other way to make this work.
Regards
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home