EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: cjytxwd on May 10, 2018, 08:14:25 PM



Title: ComboTree single selection and onlyLeafCheck
Post by: cjytxwd on May 10, 2018, 08:14:25 PM
I want to use ComboTree to select single leaf node.
Code:
$('#testcombotree').combotree({
    multiple: flase,
    checkbox: true,
    cascadeCheck: false,
    onlyLeafCheck: true
})
But the checkbox doesn't appear, and I can select non-leaf node. Is there a way to select or check single leaf node?


Title: Re: ComboTree single selection and onlyLeafCheck
Post by: stworthy on May 11, 2018, 01:06:20 AM
Please try this code:
Code:
$('#cc').combotree({
multiple: true,
onlyLeafCheck: true,
onCheck: function(node, checked){
var cc = $(this).combotree('combo');
$(cc).combotree('hidePanel');
$(cc).combotree('setValue', checked?node.id:null);
}
})


Title: Re: ComboTree single selection and onlyLeafCheck
Post by: cjytxwd on May 11, 2018, 01:19:11 AM
 :DThat works perfect! Thank you stworthy!