我将 set_type 方法绑定到我的 jstree 实例,然后在单击按钮时调用 set_type 方法。这是我的代码:
$("#treeDiv").jstree({..}).bind("set_type.jstree", function(e, data) {
$.post(
"./classes/jstree/_demo/server.php",
{
"operation" : "set_type",
"id" : data.rslt.obj.attr("id").replace("node_",""),
"type" : data.rslt.obj.attr("type")
},
function (r) {
if(!r.status) {
$.jstree.rollback(data.rlbk);
}
}
);
});
$("#settype").click(function() {
$("#treeDiv").jstree("set_type", "block", "#node_663");
});
图标的类型发生了变化,但 db 中的类型值没有变化。我究竟做错了什么?