What method is available to run a function directly after a DemandLoad callback has finished loading nodes on the client side? The DemandLoad ClientSide event only seems to run before, not after, the callback.
Hello,
I just want to update this thread in case you guys are still struggling with this and in case someone else find this thread via search. I have found a relatively painless workaround that does not require modifying ig_shared. Hopefully you can use it until we implement AfterDemandLoad event.
The idea is to use the client side object model (CSOM) of the treeview and and use the getPopulated() method of the node. You can call it with a time, say, each 1000 miliseconds, and if it is populated, call the respective method you need.
Here is my implementation:
<script language="javascript"> var node; function demandLoad(treeID, nodeID) { node = igtree_getNodeById(nodeID); window.setTimeout("checkIfComplete()", 1000); } function checkIfComplete() { if (!node.getPopulated()) window.setTimeout( "checkIfComplete()" , 1000); else requestComplete(); } function requestComplete() { alert("Request Complete"); } </script> <ignav:UltraWebTree ID="UltraWebTree1" runat="server" LoadOnDemand="AutomaticSmartCallbacks" ondemandload="UltraWebTree1_DemandLoad"> <ClientSideEvents DemandLoad="demandLoad" /> <Nodes> <ignav:Node Text="Root" ShowExpand="true"></ignav:Node> </Nodes> </ignav:UltraWebTree>
Please, let me know if this helps.
Yes guys, I also tried to find a way around this (that does not involve modifying ig_shared and manually hooking an "after" event), but was not able to.
The best I can do is to make sure your feedback reaches our development team - we do need to provide a way to cancel some "before" client events and also need to implement some new new "after" events - and this is a perfect example.
I will pass this information to our development team.
Hope this helps.
Thanks; all I need is a custom js function to fire after the demand on load returns.
Sean
I'm going to fire off a request to Infragistics in the morning regarding this, as it seems a significant oversite that just has us thinking we must be missing something - having the expand on demand functionality is working really well for us, but failed interface testing immediately on the security scenarios. Our requirement was reasonably straight forward, in that we needed to redirect the user in scenarios such as 'the users session had expired' or 'their login revoked'. Our workaround was to simply add a header to the http response, and pick it up as follows in <ig_shared.js>....
igRedirectHeader = 'IGSmartCallbackRedirect';
igRedirectTarget = this._xmlHttpRequest.getResponseHeader(igRedirectHeader);
document.location.replace(igRedirectTarget);
}
If Infragistics were to implement new functionality to allow application specific code to be invoked after the DemandLoad, are there any specific requirements you had in mind that you would like me to include in the request?
Cheers, James.
I was hoping for a more elegant solution, but so far I've done the same as you.