我有一个引导树 View ,它有两个级别。而且我需要向树 View 中的不同节点添加不同的按钮。
这是我的结构
var tree = [
{
text: "Parent 1",
nodes: [
{
text: "Child 1",
nodes: [
{
text: "Grandchild 1"
},
{
text: "Grandchild 2"
}
]
},
{
text: "Child 2"
}
]
}
];
我需要在每个子节点(此处为子1和子2)上显示一个按钮,作为“上传”,并需要在子孙级别中添加两个按钮,分别称为“删除”和“下载”。
像Kendo treeview这样的引导树 View 中是否有任何节点模板作为节点模板?
最佳答案
只要按照上面
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;