Hi,
One datagrid request data and bind.
if there have json data return to frontend from my server-side. The Datagrid request the url once, it's normal.
but there no json data reuturn the datagrid request twice from server.
I used Fiddler Web Debugger tool and sqlserver profiler watch this motion.
<div id="tb" style="padding:0px;height:auto">
<div>
Name: <input id="btnum" class="easyui-textbox pagetextbox" type="text">
Content: <input id="btnname" class="easyui-textbox pagetextbox" type="text">
Date: <input class="easyui-datetimebox" editable="false" name="btbegintime" id="btbegintime" style="width:145px" />
To <input class="easyui-datetimebox" editable="false" name="btendtime" id="btendtime" style="width:145px" />
<a id="btnLoad" href="#" class="easyui-linkbutton" iconcls="icon-search" onclick="doSearchPage()">Query</a>
</div>
</div>
<div id="gridmaster"></div>
<script>
$(function () {
$('#btbegintime').datetimebox('setValue', '2015-10-06 00:00:00');
$('#btendtime').datetimebox('setValue', '2015-10-06 23:59:59');
$('#gridmaster').datagrid({
title: '',
url: '/Box/Log/Reload',
method: 'get',
dataType: "json",
fit: true,
toolbar: '#tb',
fitColumns: true,
rownumbers: true,
striped: true,
view: scrollview,
autoRowHeight: false,
pageSize: 25,
pagination: false,
remoteSort: false,
columns: [[
{ field: 'logid', hidden: true, title: 'ID' },
{ field: 'sysfunname_cn', title: 'sysfunname_cn', width: '120px', sortable: true },
{ field: 'contents', title: 'contents', width: '300px', sortable: true },
{ field: 'ip', title: 'IP', width: '90px', sortable: true },
{ field: 'emname_st', title: 'emname_st', width: '80px' },
{ field: 'builddate', title: 'builddate', width: '130px' }
]],
queryParams: {
number: $('#btnum').val(),
name: $('#btnname').val(),
begintime: $('#btbegintime').datetimebox('getValue'),
endtime: $('#btendtime').datetimebox('getValue')
},
singleSelect: true,
selectOnCheck: false,
checkOnSelect: false,
onLoadSuccess: function (data) {
if (data.rows.length > 0) {
$('#gridmaster').datagrid("selectRow", 0);
}
}
});
});
function doSearchPage() {
$("#gridmaster").datagrid('load', {
number: $('#btnum').val(),
name: $('#btnname').val(),
begintime: $('#btbegintime').datetimebox('getValue'),
endtime: $('#btendtime').datetimebox('getValue')
});
}
</script>
json data