EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: hahamed on August 05, 2015, 10:19:11 PM



Title: tree and hide/show checkbox
Post by: hahamed on August 05, 2015, 10:19:11 PM
Hello

When I use:
Code:
$('#tree').tree({ checkbox: true });
Or
Code:
$('#tree').tree({ checkbox: false});
my tree rebinds its data and request data from my server second time.

Why tree has not showCheckbox or hideCheckbox methods?


Title: Re: tree and hide/show checkbox
Post by: jarry on August 06, 2015, 06:17:45 AM
It is easy to extend these two methods.
Code:
(function($){
$(function(){
var css = $('#extend_tree_css');
if (!css.length){
$('<style id="extend_tree_css">.tree-checkbox-hidden .tree-checkbox{display:none}</style>').appendTo('head');
}
});
$.extend($.fn.tree.methods, {
showCheckbox: function(jq){
return jq.each(function(){
$(this).removeClass('tree-checkbox-hidden');
})
},
hideCheckbox: function(jq){
return jq.each(function(){
$(this).addClass('tree-checkbox-hidden');
})
}
})
})(jQuery);