我正在使用jsTree。我想将子节点选择限制为 4 个(要么不允许用户选择超过 4 个节点,要么禁用所有复选框)。我正在使用不起作用的选择限制。我怎样才能实现这个目标?
$("#mytree").jstree({
"plugins" : [ "themes","html_data", "ui", "crrm","checkbox" ],
"html_data" : {
// ...
},
"checkbox": {
"keep_selected_style": false
},
"ui": {
"select_limit": 4,
},
// ...
});
最佳答案
我自己也遇到了这个问题。
如果您使用 jsTree v3+,“UI”插件不再存在,“select_limit”属性也不再存在。 This is the current list of plugins that are available.
如果您只想一次选择一个选项,核心模块有一个“multiple”属性,您可以根据需要将其设置为 true/false。但如果您想将其限制为四个选择,则 the author recommended using the "conditional select" plugin .
关于javascript - 限制jstree中子节点的选择数量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38562599/