Hello,
i want to change the imageurl on client, if a node is expanded or collapsed. In my case i want to show a FolderClose-icon if node collapsed and a FolderOpen-icon if it is expanded. I can do that in server-side code but this causes a roundtrip to the server.
Is there a possibility to do that on client? I saw the ClientEvents NodeExpanded and NodeCollapsed but no methods to change the imageurl. Or is it possible to do that via CSS?
Thanks
Martin
Hi Stumpy74,
Please feel free to contact me if you have any questions regarding this matter.
Hi Martin,
Thank you for posting in the community.
It is possible to change the image source of a node by accessing the respective html element. Below is some sample code illustrating how this can be achieved for node expansion using jQuery:
function WebDataTree1_NodeExpanded(sender, eventArgs) { //get the node element and subsequently change the node image's src var nodeElement = eventArgs.getNode().get_element(); $(nodeElement).children(".igdt_NodeImage").first().attr("src", "ig_res/Default/images/add_down.gif");}
function WebDataTree1_NodeExpanded(sender, eventArgs) { //get the node element and subsequently change the node image's src
var nodeElement = eventArgs.getNode().get_element(); $(nodeElement).children(".igdt_NodeImage").first().attr("src", "ig_res/Default/images/add_down.gif");}
Please let me know if this helps.