Many components have 'onBeforeLoad' event, which can be used to determine if to load data. Here is the code shows how to prevent from loading data into datagrid at first time and call 'reload' method again to load data normally.
$('#dg').datagrid({
onBefore:function(){
var opts = $(this).datagrid('options');
if (!opts.canLoad){
opts.canLoad = true;
return false;
}
}
});
The loading behavior can also be applied to all the datagrid components.
$.fn.datagrid.defaults.onBeforeLoad = function(){
var opts = $(this).datagrid('options');
if (!opts.canLoad){
opts.canLoad = true;
return false;
}
}