bootstrap-treeview中只有自增的参数data-nodeid,没有id的参数,不方便后台交互,修改源码添加id。
var tree = [
{
text:"Parent 1",
nodeid:"10",//增加的参数
nodes: [
{
text:"Child 1",
nodeid:"101",//增加的参数
nodes: [
{
text:"Grandchild 1",
nodeid:"102"
},
{
text:"Grandchild 2",
nodeid:"103"
}
]
},
{
text:"Child 2",
nodeid:"11"
}
]
}
];
F12查看结果:添加了自定义的id。