如何限制在jstree中选择的children个parent个数?
how to Restrict the number of children of parent selected in jstree?
如何限制 parent 中选择的 children 的数量?
请帮助我
function buildTree(data) {
var dataJson = JSON.parse(data);
$("#onflycheckboxes").jstree({
"json_data": {
data: dataJson,
},
checkbox: {
real_checkboxes: true,
checked_parent_open: true,
three_state: false
},
"search": {
"case_insensitive": true,
"show_only_matches": true
},
"plugins": ["themes", "json_data", "ui", "checkbox", "search"]
});
}
对于检查节点,您必须使用 $("#onflycheckboxes").jstree('get_checked')
in jstree
function buildTree(data) {
var dataJson = JSON.parse(data);
$("#onflycheckboxes").jstree({
"json_data": {
data: dataJson,
},
checkbox: {
real_checkboxes: true,
checked_parent_open: true,
three_state: false
},
"search": {
"case_insensitive": true,
"show_only_matches": true
},
"plugins": ["themes", "json_data", "ui", "checkbox", "search"]
}).bind("before.jstree", function (e, data) {
if (data.func === "check_node") {
if ($("#onflycheckboxes").jstree('get_checked').length >= numberOfCompanies) {
e.preventDefault();
toastMessage();//your message for show to user can't select any more
return false;
}
}
});;
如何限制 parent 中选择的 children 的数量? 请帮助我
function buildTree(data) {
var dataJson = JSON.parse(data);
$("#onflycheckboxes").jstree({
"json_data": {
data: dataJson,
},
checkbox: {
real_checkboxes: true,
checked_parent_open: true,
three_state: false
},
"search": {
"case_insensitive": true,
"show_only_matches": true
},
"plugins": ["themes", "json_data", "ui", "checkbox", "search"]
});
}
对于检查节点,您必须使用 $("#onflycheckboxes").jstree('get_checked')
in jstree
function buildTree(data) {
var dataJson = JSON.parse(data);
$("#onflycheckboxes").jstree({
"json_data": {
data: dataJson,
},
checkbox: {
real_checkboxes: true,
checked_parent_open: true,
three_state: false
},
"search": {
"case_insensitive": true,
"show_only_matches": true
},
"plugins": ["themes", "json_data", "ui", "checkbox", "search"]
}).bind("before.jstree", function (e, data) {
if (data.func === "check_node") {
if ($("#onflycheckboxes").jstree('get_checked').length >= numberOfCompanies) {
e.preventDefault();
toastMessage();//your message for show to user can't select any more
return false;
}
}
});;