I am working on mulitple WebDataTree's in a single page on different tabs.
As per requirement, user should be able to create new childs under any selected node of the current displayed tree. I am creating nodes in WebDataTree using WebDataMenu (Context menu). User can create a node by right clicking on 'Create' menu item of WebDataMenu control.
I am using javascript functions of infragistics to create nodes and it creates first child successfully under the selected node but if I want to create child under newly created node, it always creates under the root node. Can anybody suggest how to fix this.
Please suggest asap.
following javascript code i wrote on WebDataMenu click:
function MenuItem_Click(menu, eventArgs) { var type = eventArgs.getItem().get_key(); var menuName = eventArgs.getItem().get_text(); var oItem = menu; var currentTree = GetCurrentTree(); // it gives me current tree
var node = null; var address = null; node = currentTree.get_selectedNodes()[0]; // getting selected node reference parentId = node.get_valueString(); // getting Node Id var newNode = new Object(); //json object newNode.ParentId = parentId; var resData = SendReqForNewAsset(newNode); //sending request to service address = $adrutil.getAddressFromDomElement(node.get_element()); // getting address of current selected node var newnode1 = currentTree.createNode(resData.d.NodeName); newnode1.set_valueString(resData.d.NodeId); //trying to set the image and navigation url of the node -- but not working newnode1._element.setAttribute('igUrl', resData.d.NavigationUrl); newnode1._element.setAttribute('igSelImage', resData.d.SelImageUrl); newnode1._element.setAttribute('igUnselImage', resData.d.ImageUrl); currentTree.add(newnode1, address);
} }
Also I want to know that
1) how to select the newly created node in javascript and unselected currently selected node.
2) how to set SelImageUrl and UnSelImageUrl to a node in WebDataTree like ultrawebtree.
Hi Naresh,
You should use the "add" method instead of "createNode" for adding nodes at different levels. For more information about WebDataTree client side API, you can look at the following url:
http://help.infragistics.com/NetAdvantage/ASPNET/2013.1/CLR4.0/?page=WebDataTree~Infragistics.Web.UI.WebDataTree_methods.html
You can also see the samples on our website - there is one dedicated to adding nodes which are children of the currently selected node:
http://ko.infragistics.com/products/aspnet/sample/data-tree/using-client-side-api
Thanks,
Dimitar Atanasov
Senior Software Engineer
Infragistics
Hi,
I saw that you are also asking about selection through the javascript API. We are currently supporting only getting an array of selected nodes using get_selectedNodes() method. You can make a node active using set_activeNode(value : Node).
More information you can find here:
http://help.infragistics.com/NetAdvantage/ASPNET/2013.1/CLR4.0/?page=WebDataTree~Infragistics.Web.UI.WebDataTree_properties.html
Please, feel free to ask for any additional information.
Thanks for your reply.
I am using add method after createNode method. createNode method gives me Node object which is demanding by add method.
Hello Naresh,
I investigated your scenario and I what I can suggest is to ensure that the InitialDataBindDepth property of WebDataTree, which determines how many levels of nodes will be data bound when tha datatree is first displayed, is being set. You have to ensure that it`s value is set to a value diffeent than -1(which signifies that all levels will be databound). If this IntialDataBindDepth property is set to -1 the event is not going to be fired because all nodes will be populated initially.
I followed the steps that you suggested and I created a sample project that I am attaching for your reference. I added some nodes on the client side and set the InitialDataBindDepth to 0 but I was unable to reproduce the behavior that you are describing - no exception is being thrown and the breakpoin that I set in the NodePopulate event is being hit every time a node is expanded. Please run this sample on your PC; whether or not it works correctly may help indicate the nature of this issue.
If this sample is not an accurate demonstration of what you are trying to achieve please feel free to modify it and send it bac or send a small isolated sample of your own where the issue is reproducible.
I hope you find this information helpful.
Please let me know if you have any additional questions regarding this matter.
In order to provide you with better and more accurate support we usually handle one issue per forum thread so what I can suggest is opening a new thread for every single issue that you have.
Currently am looking into this issue for you and I will get back to you soon with more information or questions for you.
You can continue to send updates to this case at any time.
Hi Vasya,
I am facing another issue that is OnNodePopulate event of WebDataTree.
If I add some nodes using javascript add method, after adding nodes "OnNodePopulate" event does not fire. It does not postback to server and gives this error:
"Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Input string was not in a correct format."
thanks
I am glad that you have been able to resolve your issue.
Regarding your second forum post I have created a support request on your behalf and my colleague will contact you soon with more information or questions for you.
If you are still in need of assistance please feel free to contact me.
Thanks for reply.
My problem has been solved. It was a conflict issue between UltraWebTree and WebDataTree. I were using both on the same page. I just cut and paste the reference of "Infragistics.Web.UI.NavigationControls" above the "Infragistics.WebUI.UltraWebNavigator" and my problem solved. I don't know what was the issue, but its solved.
Can you please look this another issue:
http://ko.infragistics.com/community/forums/p/81382/410256.aspx#410256