Hello I am using the IgTree Grid consisting of a parent node, when I loads it, it generates in the collapsed form for the First time but here the parent node consisting of Child data and here further the Child data node is again acting as parent node for other child nodes,suppose
(-)parent0
|
|_ _(-)parent1
| |
| |_ _(-)parent1-1
| |_ _Child1-1
|_ _(-)parent2
The parent1 and parent2 are always opening with (-) icon but the data consisting in that not expanded, we have to click (-) two time in such that first it becomes (+) and then after clicking one more time it expands, here I am using $("#treegrid").igTreeGrid("collapseRow", "0"); method to make every sub parent to be collapsed but it is not working here, as i thinks the problem aries when I again make the Child node to be parent node by using addChild mehod, because an blank lines adds into it. After all the issue is the grid works but by double clicking on the nodes to open i.e. on 1st Click it (+) collapses then on 2nd Click it actually now expands (-). Help me out.
Hello Ashish,
The customEncodeUrlFunc cannot be used to populate the child data.Its purpose is to customize the url used when making the remote request to get the child data.
Instead of manually triggering an ajax call to get the data you can let the grid initiate the call when a row is expanded and customize the url that will be used for that requets in the customEncodeUrlFunc.
For example, instead doing this on rowExpanded:
var url = getPeggingDemandList + sPdCode + '&serverName=' + '&companyName=' + companyName + '&psPlanItem=' + rowId;
$.get(url, function (data, status) {
…
}
Use the loadonDemand functionality (set enableRemoteLoadOnDemand) and modify the url so that it matches the url format your backend expects:
customEncodeUrlFunc: myUrlParamsEncoding
var myUrlParamsEncoding = function (item, params) {
return url;
In this way the grid will initiate the remote ajax request and will process and bind the child data returned by the service automatically.
Let me know if you have any additional questions.
Best Regards,
Maya Kirova
Infragistics, Inc.
http://es.infragistics.com/support
Hello Maya,
It works but as you said i removed the "#@#" concatenation from my Id and have putted some simple string in place of it, I am not using the enableRemoteLoadOnDemand: true here. Let me know about some quires asked above for your sample code you attached
Could you check your browser’s console after the call to collapse the row:
$("#treegrid").igTreeGrid("collapseRow", paggingData.O_PLAN_ITEM + "#@#" + paggingData.O_DEMAND_ID); //* If now I wants to collapse it this won't work
It seems that the row id contains special characters, which is not supported for the grid so the following call may throw an exception.
Could you remove the special characters from the id and let me know if that solves your issue?
Hey Maya, Thanks for the sample,I go through it but have some problem facing in the customizations.
Let me clear one thing, here customEncodeUrlFunc: myUrlParamsEncoding here the myUrlParamsEncoding method returns a url but I want here to return a dataset for the Child Data which can be filled in the Grid, as I have to use AJAX which will return a JSON String here.
enableRemoteLoadOnDemand: true won't work for me, can you help me with a jquery/javascript snippet in which I can also make the Child Key acting as parent for further child keys, earlie I used addChild method for achieving that but, these cause the unnecessary adding of one blank line and may be because of these the signs ("-") is with that node element, herer I am using VB.net Controller as my Service which return a JSON String, and by converting that string to JSON Object I put these data to grid by addChild method