'undefined' after add node

7 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. 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 ....
  4. 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
     
  5. 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);

  6. JV
    JV avatar
    1 posts
    Member since:
    May 2016

    Posted 06 Feb 2018 Link to this post

    does any one have a similar problem like this?

    code js ->

    controllerx.grid_options ={

    rowTemplate: kendo.kendoTreeView($("#mx-Ensemble").html()),   <-- this does not work

    }

    but when I use

    controllerx.grid_options ={

    rowTemplate: kendo.template($("#mx-Ensemble").html()),   <-- this does WORK
    }

    HTML -> code

     

    <script id="mx-Ensemble" type="text/x-kendo-tmpl"> </script>

    <div kendo-grid="mainGrid" options="vm.options"></div>

     

  7. Ivan Danchev
    Admin
    Ivan Danchev avatar
    2053 posts

    Posted 09 Feb 2018 Link to this post

    Hello,

    kendo.kendoTreeView is not a valid API method. The HTML passed as rowTemplate must be a <tr> element. As specified in the documentation the Grid's rowTemplate option expects either a string, for example:
    rowTemplate: '<tr data-uid="#= uid #"><td colspan="2"><strong>#: name #</strong><strong>#: age #</strong></td></tr>'
    or a function:
    rowTemplate: kendo.template($("#template").html())

    The kendo.template method returns the generated HTML string, which again must contain a <tr> element.

    Regards,
    Ivan Danchev
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top