我的jstree代码如下:
href="/static/manage/js/jstree/themes/default/style.min.css">
$('#jstree_demo')
.jstree(
{
"core" : {
"animation" : 0,
"check_callback" : true,
"themes" : {
"stripes" : true
},
'data' : {
'url' : function(node) {
var jsonData = JSON.stringify(node);
alert(jsonData);
return node.id === '#' ? '/manage/competence/getCPList?parentId=-1'
: '/manage/competence/getCPList';
},
'data' : function(node) {
return {
'id' : node.id
};
}
}
},
"types" : {
"#" : {
"max_children" : 1,
"max_depth" : 4,
"valid_children" : [ "root" ]
},
"root" : {
"icon" : "/static/manage/js/jstree/themes/images/tree_icon.png",
"valid_children" : [ "default" ]
},
"default" : {
"valid_children" : [ "default", "file" ]
},
"file" : {
"icon" : "glyphicon glyphicon-file",
"valid_children" : []
}
},
"plugins" : [ "contextmenu", "dnd", "search", "state",
"types", "wholerow" ]
});
$('#jstree_demo').on("changed.jstree", function(e, data) {
if (data.selected != "") {
console.log(data.selected);
//alert(data.selected);
changeCompetence(data.selected);
window.location.href='/manage/competence/index.htm#'+data.selected
}
});
请教大神帮忙看看,因为我数据库中的id必须要个这个node.id一致,不知道改则呢么改了