1. Traditional way
<span style= "FONT-SIZE:18PX;" >$ (function () {
var url = ".. /source/query/jhdataqry.ashx?action=query ";
$ (DG). DataGrid ({
url:url,
queryparams: {
qsrq:qsrq,
zzrq:zzrq
}
}
) <table id= "DataGrid" class= "Easyui-datagrid" fit= "true" border= "false" toolbar= "#TBar" pagination= "true"
data-options= "Pagesize:20,pagelist: [Ten, A, 50,100,5000],idfield: ' Chjid ', sortname: ' Chjbh ', Queryparams: {' Action ': ' Query '} '
rownumbers= ' true ' singleselect= ' true ' url= '. /source/jichu/chjdoc.ashx ">
<thead>
<tr>
</tr>
</thead>
</table></span>
2. Reason Analysis and solution
The HTML code uses class to declare the DataGrid, which causes Easyui parsing class code to parse the DataGrid in the class declaration first, so that the component requests a URL, and then calls the JS initialization code to request a URL at a time. This results in repeated loading by simply declaring the Easyui component in an initialization way to avoid duplicate commit requests, that is, to delete the class declaration (class= "Easyui-datagrid") in HTML, and the modified code is as follows:
<span style= "FONT-SIZE:18PX;" ><table id= "DataGrid" fit= "true" border= "false" toolbar= "#TBar" pagination= "true"
data-options= "PageSize" : 20,pagelist: [A, M, 50,100,5000],idfield: ' Chjid ', sortname: ' chjbh ' '
rownumbers= ' true ' singleselect= ' True "Url=". /source/jichu/chjdoc.ashx ">
<thead>
<tr>
</tr>
</thead>
</ Table></span>