This is a migrated thread and some comments may be shown as answers.

Unable to get value of the property '_getHierarchicalIndex': object is null or undefined

3 Answers 78 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
mirang
Top achievements
Rank 1
mirang asked on 17 Feb 2012, 02:53 PM
getting the following error
 Unable to get value of the property '_getHierarchicalIndex': object is null or undefined
when i try to remove a node on the client side

Following is the sequence
- I am creating some initial nodes from the server
- I am clearing the treeview on some client operation
- After clearing, I am again populating the treeview on the client side itself.
- After that When I expand some node and try to delete any node under it, I get the above error.

This error is also intermittent, it comes for some nodes and not for some. 
I tried to debug the js code, but without success. Can you please point me to some points, which can get me to the crux of the problem. I am not able to identify what might be causing this script error.
I get this error in the latest(Q12012) and its previous version of telerik asp.net ajax control toolkit.  

3 Answers, 1 is accepted

Sort by
0
mirang
Top achievements
Rank 1
answered on 20 Feb 2012, 09:23 AM
Actualy the problem was, while clearing the treeview on client side the clientstate was not getting cleared, which was causing this problem some how. Following code did that  :
treeView.get_nodes().clear();
    treeView._clientState.expandedNodes = [];
    treeView._clientState.collapsedNodes = [];
    treeView._clientState.checkedNodes = [];
    treeView._clientState.selectedNodes = [];

Can you please let me know, if the above solution is Ok or not ?
0
Bozhidar
Telerik team
answered on 20 Feb 2012, 11:27 AM
Hi Mirang,

Whenever you do some modifications to the tree on the client and you want them to be persisted on the server, you have to use the trackChanges() and commitChanges() functions. They automatically take care of the clientstate field, so you don't have to do that manually. They are functions of the tree, so in your case the code should be:
treeView.trackChanges();
treeView.get_nodes().clear();
treeView.commitChanges();

 
Regards,
Bozhidar
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
mirang
Top achievements
Rank 1
answered on 20 Feb 2012, 12:47 PM
Thanks a Lot for your reply. Will try out your solution
Tags
TreeView
Asked by
mirang
Top achievements
Rank 1
Answers by
mirang
Top achievements
Rank 1
Bozhidar
Telerik team
Share this question
or