How to remove all data in a datagrid?
i know before another way to clear a datagrid is using
$('#cc').datagrid('loadData', []);
or
$('#cc').datagrid('loadData', {"total":0,"rows":[]});
or
var rows = $('#cc').datagrid('getSelections'); // get all selected rows
for(var i=0; i<rows.length; i++){
var index = $('#cc').datagrid('getRowIndex',rows[i].id); // get the row index
$('#cc').datagrid('deleteRow',index);
}
....why don't we just call
$('#cc').datagrid('clear')
just like the combogrid???
and somehow ive just found a bug...
if you call this script
$('#cc').datagrid('loadData', []);
it will reload the current datagrid remotely and then populated with the local empty data..
just look at pic below, the datagrid load data remotely then localy after i fired the $('#cc').datagrid('loadData', [])
i need explanation..
thanks in advance.