TreeView node does not selectable after changing the text.

3 posts, 1 answers
  1. Daochuen
    Daochuen avatar
    64 posts
    Member since:
    Sep 2017

    Posted 13 Mar 2019 Link to this post

    Hello,

    After I changed  node's display text in client side the node become not selectable.  for example I have treeview as below: 

    $("#treeview").kendoTreeView({
      dataSource: [
        { text: "foo", id:"1", items: [
          { text: "AAA",id:"2" } ] }
      ]
    });

    I changed "AAA" to "BBB"  by button click (see below code). after that I cannot select that node anymore. the node with 'BBB' function as a LABEL. Does anyone has idea how to resolve it?

     

      $("#btn").click(function(){
         var treeview = $("#treeview").data("kendoTreeView");               
          var myDataItem=treeview.dataSource.get(2); 
          var node = treeview.findByUid(myDataItem.uid);
          node.text("BBB");
          treeview.select(node);
         
     });

  2. Answer
    Eyup
    Admin
    Eyup avatar
    4025 posts

    Posted 14 Mar 2019 Link to this post

    Hi Daochuen,

    You are very close. All you need to change is to use the built-in text method provided by the treeview:
    https://docs.telerik.com/kendo-ui/api/javascript/ui/treeview/methods/text

    In this case it will be:
    $("#btn").click(function(){
      ...
      treeview.text(node, "BBB");
    });

    Here is the full dojo sample:
    https://dojo.telerik.com/izuFObIk/4

    I hope this will prove helpful.

    Regards,
    Eyup
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Daochuen
    Daochuen avatar
    64 posts
    Member since:
    Sep 2017

    Posted 14 Mar 2019 in reply to Eyup Link to this post

    Thanks, that worked great!
Back to Top