For quick fix, I have to change datagrid pageSize option manually before reload data from service(implement datagrid onBeforeLoad event). I'm not sure if this is an easyui defect. Any help is appreciated.
This is how I got it working. Comment out onBeforeLoad event, it fails to work properly.
Code:
$('#table').datagrid({
url: 'datagrid.json',
pagination: true,
columns: [[
{ field: 'id', title: 'Id', width: 100 }
]],
onBeforeLoad: function (param) {
var pageSize = $(this).datagrid('getPager').pagination('options').pageSize;
if (param.rows !== pageSize) {
param.rows = pageSize;
$(this).datagrid('options').pageSize = pageSize;
}
return param;
}
});
setTimeout(function () {
$('#table').datagrid('getPager').pagination('refresh', { pageSize: 20 });
setTimeout(function () {
$('#table').datagrid('reload');
}, 30);
}, 3000);