Problem with callback-function of the expandPath-function

2 posts, 0 answers
  1. Xaver
    Xaver avatar
    6 posts
    Member since:
    Jan 2015

    Posted 04 Mar 2015 Link to this post

    Hi,

    I have problems with the callback-function of the expandPath-function.
    Is it possible that this callback-function is not executed, when the path-Array (first parameter of the expandPath-function) is [0]?

    What i am trying to implement is when a new child-item is created then the parent-item should be reloaded and after that the new child-item should be selected.
    This works fine, only when this new item is child of the root-item (with id 0) the callback-function, which selects the item, is not executed.

    var parentItem = wpTreeView.dataSource.get(parentId);
    parentItem.expanded = false;
    parentItem.loaded(false);
    parentItem.hasChildren = true;
     
    wpTreeView.expandPath([parentId], function () {
        var newItem = wpTreeView.dataSource.get(data.Id);
        var newListItem = wpTreeView.findByUid(newItem.uid);
        console.log(newListItem);
        wpTreeView.select(newListItem);
    });


    Can someone give me some advice?

    Regards,
    Xaver
  2. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 06 Mar 2015 Link to this post

    Hello Xaver,

    The expandPath method expects that the id can be found in the TreeView DataSource via get. If the parent item can be found, it will be expanded.

    Given the code that you posted, it could be that the newly created item is not loaded from the server, or that its uid is changed (because the data item has changed). Please verify that the item is correctly found prior to selecting. If you need help with this, please submit a sample that shows the problem.

    Regards,
    Alex Gyoshev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top