Is it possible to cancel or abort the xml loading of a dhtmlxgrid at it’s setOnLoadingStart() function handler?
Hope for your reponse…
rgds,
bonjo
The setOnLoadingStart is only informative event, it can’t block the loading of XML ( in most cases blocking the xml loading can cause inner state corruption )
Is this answer still valid? And is it the same for the dhtmlx-tree?
Because I am loading a tree depending on some context. And as the loading can take quite a while I want to have the option to alter that context, which makes the tree smaller. But as long as there is no way to cancel the first loading, there would be no advantage in speed! Maybe some very simple, not-dhtmlx-related solution (as every browser is able to cancel a request)?
Yes, the onXLS event is informative only, and can’t be used for blocking data loading.
>>But as long as there is no way to cancel the first loading
You can access last created request object as
grid.xmlLoader.xmlDoc
and block the current load as
var t=grid.xmlLoader.xmlDoc.onreadystatechange;
grid.xmlLoader.xmlDoc.onreadystatechange=function(){}
grid.xmlLoader.xmlDoc.abort();
grid.xmlLoader.xmlDoc.onreadystatechange=t;
The same must work for dhtmlxtree as well.
Please beware that in case of dynamical loading mode, there may be multiple active loaders in same time, described code allows to access only latest one.
>> var t=grid.xmlLoader.xmlDoc.onreadystatechange;
Produces an “Permission denied to create wrapper for object of class UnnamedClass” exception in Firefox… which seems (!) to be a security restriction of FF - didn’t find a workaround… I don’t really need to (re-)store the current onreadystatechange, though, but the solution would be interesting
>> grid.xmlLoader.xmlDoc.abort();
OK, thanks. A thing I wasn’t aware of, as a note for the next user: At least as far as I understand (and it makes sense), this abort doesn’t stop the server from executing the request, it just prevents the returned result to be executed by the client. So you don’t save the server’s processing-time