'undefined' after add node

5 posts, 0 answers
  1. Nanthaphol
    Nanthaphol avatar
    4 posts
    Member since:
    Jul 2012

    Posted 30 Jul 2012 Link to this post

    Hi, I'm try to insert node in treeview like demo

    this is my code

    var treeviewData = $("#treeview").data("kendoTreeView");
    var selectedNode = treeviewData.select();
    treeviewData.append({text: Name}, selectedNode);

    ,but after insert at child node is undefined data

    can I fix this problem
  2. Ambica
    Ambica avatar
    14 posts
    Member since:
    May 2012

    Posted 31 Jul 2012 Link to this post

    Hi,

    Even I am facing same problem ,  its not working for first element as well.
    var treeView = $("#divTreeView").data("kendoTreeView");
        treeView.insertAfter({ text: "JavaScript" }, $("#firstItem"));

    Please any one help us.

  3. Kendo UI is VS 2017 Ready
  4. Ambica
    Ambica avatar
    14 posts
    Member since:
    May 2012

    Posted 31 Jul 2012 Link to this post

     we have to give $(selectedNode) instead of 
    selectedNode as below.
      var treeView = $("#divTreeView").data("kendoTreeView");        var selectedNode = treeView.select();            treeView.append({ text: "Meanwhile, in HTML5..." }, $(selectedNode)); Its working ....
  5. Nanthaphol
    Nanthaphol avatar
    4 posts
    Member since:
    Jul 2012

    Posted 31 Jul 2012 Link to this post

    I see problem by Javascript Debug

    you can see this line "treeviewData.append({text: Name}, selectedNode); "
    text : " " isn't data to show on child node,you can solve this problem by

    treeviewData.append({Name:$("#name").val(),id:id_node}, selectedNode);

    you can see Name: is set data to show on child node and you can set id node too

    thx everyone
     
  6. ali
    ali avatar
    13 posts
    Member since:
    Dec 2010

    Posted 31 May 2015 Link to this post

    i used name property instead of text or title

    and worked

     treeview.append({
                Name: nodeText,
                id: nodeValue
            }, selectedNode);

Back to Top
Kendo UI is VS 2017 Ready