Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
55
Simulate Node Click with CSOM
posted

Hi,

I am programatically creating nodes on a web tree using Javascript and I would like to simulate the node being clicked after it is created so as to cause the appropriate client side event handler to be called, then the postback to occur and the server side event handler to be called.

 I've tried doing this by setting the node to be selected then calling oNode.WebTree.Element.click()  since it seems as though it's only the tree DIV element which has any onclick handlers. Unfortunately this has no effect.

 Hope you can help.

 Thanks,

Stuart

Parents
No Data
Reply
  • 305
    Offline posted

    Hi!

     I dig into Infragistics javascripts file... And I find out a way to achieve your needs... :)

    This is something ugly because if infragistics changes its implementation (in a future version) this code may fail:

    var oTree = igtree_getTreeById('<treeid>');  //Getting tree object

     

    var oNode = oTree.insertRoot(0, "popo");  //Insert the new node

     

    oNode.getElement().getElementsByTagName("span")[0].click();   //Execute click in the rigth html element

    I tried this with a simple tree without images and checkboxes. I don't know if setting some UltraWebtree properties the render may be something diferent, with more spans that will cause a fail.

    Bye,

    Carlos Marcão

Children