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

4 posts, 0 answers
  1. mirang
    mirang avatar
    115 posts
    Member since:
    Aug 2010

    Posted 17 Feb 2012 Link to this post

    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.  
  2. mirang
    mirang avatar
    115 posts
    Member since:
    Aug 2010

    Posted 20 Feb 2012 Link to this post

    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 ?
  3. Bozhidar
    Admin
    Bozhidar avatar
    1189 posts

    Posted 20 Feb 2012 Link to this post

    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 >>
  4. mirang
    mirang avatar
    115 posts
    Member since:
    Aug 2010

    Posted 20 Feb 2012 Link to this post

    Thanks a Lot for your reply. Will try out your solution
Back to Top