Im loading some html in a windows using attachUrl function.
[code] var popup = $MainPage.$MainLayout.dhxWins.createWindow("form", 0, 0, 600, 600);
popup.attachURL(url, true);[/code]
I’d like to run some JS code which is interacting with the loaded content. But I’m getting errors beacause the content is not ready yet.I noticed the attachURL has not a postback function call.
So have can i solve this ?
It would be nice to have something like
[code] popup.attachURL(url, true,function(){
//some code
});
[/code]
Have you attempted to use
setTimeout('functionName()',1);
?
How do I know how many miliseconds are needed ?
What if the loading of the page will took longer time then the setted time ?
attachURL(url,true) loads content asynchronously, by Ajax. You may set onContentLoaded event handler that will be called when the response received:
popup.attachEvent(“onContentLoaded”,function(w){
alert(“loaded!!”);
})
popup.attachURL(url, true);
the event is not fired after the content is loaded
[code] var popup = $MainPage.$MainLayout.dhxWins.createWindow(“form”, 0, 0, 600, 600);
popup.attachEvent("onContentLoaded", function (win) {
alert("sss");
});
popup.attachURL(url, true);[/code]
Sorry for the misleading information event handler should be attached to the dhtmlXWindows object instead of a certain window:
$MainPage.$MainLayout.dhxWins.attachEvent(“onContentLoaded”, function (win) {
alert(“sss”);
});