To prevent from triggering onCheck event when loading data, change onCheck event to an empty function and then restore it after load successfully.
var t = $('#tt'); // the tree object
var opts = t.tree('options');
var onCheck = opts.onCheck;
opts.onCheck = function(){};
t.tree('loadData',...); // load data with no 'onCheck' event triggered
opts.onCheck = onCheck; // restore the 'onCheck' event handler
If you are loading data from 'url', the better way is to customize the loader function.
$('#tt').tree({
loader: function(param, success, error){
var opts = $(this).tree('options');
if (!opts.url) return false;
var onCheck = opts.onCheck;
opts.onCheck = function(){};
$.ajax({
type: opts.method,
url: opts.url,
data: param,
dataType: 'json',
success: function(data){
success(data);
opts.onCheck = onCheck;
},
error: function(){
error.apply(this, arguments);
opts.onCheck = onCheck;
}
});
}
});