4

I've a bootstrap treeview which has two levels. And I need to add different buttons to different nodes in the treeview.

here is my structure

var tree = [
  {
    text: "Parent 1",
    nodes: [
      {
        text: "Child 1",
        nodes: [
          {
            text: "Grandchild 1"
          },
          {
            text: "Grandchild 2"
          }
        ]
      },
      {
        text: "Child 2"
      }
    ]
  }

];

And I need to display a button on each Child node (here Child 1 & Child 2) as "Upload" and need to add two buttons called "Delete" & "Download" in Grandchild levels.

Is there any thing as node templates in bootstrap treeview like Kendo treeview?

tarzanbappa
  • 4,930
  • 22
  • 75
  • 117

1 Answers1

1

Just follow the above

 var btnid = 'btnEdit_node_' yourrecordid;
    var button = " <div/><button type='button'  id='btnEdit_" + data.id + "'  class='btn btn-primary' onclick='exxecutefunction()'>" +
        "<i class='glyphicon glyphicon-edit'></i> Edit" +
        "</button>";

    var node = {};
    node.text = data.description + button;
kostas ch.
  • 1,960
  • 1
  • 17
  • 30