私はjstreeを使用していますが、select_node.jstreeが起動しません。コードは次のとおりです
$(document).ready(function () {
//$("#MySplitter").splitter();
setupSplitter();
$("#divJsTreeDemo").jstree({
"themes": {
"theme": "default",
"dots": false,
"icons": false
},
"plugins": [
"core", "themes", "json_data", "ui", "types"
],
"types": {
// I set both options to -2, as I do not need depth and children count checking
// Those two checks may slow jstree a lot, so use only when needed
"max_depth": -2,
"max_children": -2,
// I want only `drive` nodes to be root nodes
// This will prevent moving or creating any other type as a root node
"valid_children": ["drive"],
"types": {
// The default type
"default": {
// I want this type to have no children (so only leaf nodes)
// In my case - those are files
"valid_children": "none",
// If we specify an icon for the default type it WILL OVERRIDE the theme icons
"icon": {
"image": "../../Repository/Images/file.png"
}
},
// The `folder` type
"folder": {
// can have files and other folders inside of it, but NOT `drive` nodes
"valid_children": ["default", "folder"],
"icon": {
"image": "../../Repository/Images/folder.png"
}
}
}
},
"json_data": {
"ajax": {
"type": "POST",
"url": "GetTreeNodes",
"data": function (n) {
var myJSONText = JSON.stringify({ id: n.attr ? n.attr("id").replace("node", "") : 0 }, replacer);
return { id: n.attr ? n.attr("id").replace("node", "") : 0 };
},
"success": function (data) {
$(".folder-file-container").remove();
RenderFileFolder(data);
}
}
// "data": {
// // `data` can also be an object
// "data": {
// "title": "The node title",
// // omit when not needed
// "attr": {},
// // if `icon` contains a slash / it is treated as a file, used for background
// // otherwise - it is added as a class to the <ins> node
// "icon": "../../Repository/Images/pdf.png"
// },
// // the `metadata` property will be saved using the jQuery `data` function on the `li` node
// }
}
}).bind("select_node.jstree", function (e, data) {
alert(data.rslt.obj.data("id"));
});
});