谢谢mcabral和Tomasz的回答。它帮助我取得了正确的结果。但是,我需要添加一些额外的行才能正常工作。下面是我做的:
您需要两个属性添加到<li>
标签至极是rel='disable'
指示jstree,这将是新类型的复选框,而不是默认和class='jstree-checked'
属性,它会预先检查加载树时的复选框。
$rel = ('if the checkbox need to be pre-checked')? 'rel="disabled" class="jstree-checked"' : '';
echo '<li id="checkbox_id" '. $rel .'>';
然后根据你需要定义在rel属性中使用如下的“禁用”型以前的答案:
.jstree({
"types" :
{
"types" : {
"disabled" : {
"check_node" : false,
"uncheck_node" : false
}
}
},
"plugins" : ["themes","html_data","ui","crrm","types", "checkbox"],
"checkbox" : { "two_state" : true },
})
考虑以更undestandable重写的问题。 – athspk