1. Traditional Methods
1 $ ( Function (){ 2 VaR Url = "../source/query/jhdataqry. ashx? Action = query" ; 3 $ (DG). DataGrid ({ 4 URL: URL, 5 Queryparams :{ 6 Qsrq: qsrq, 7 Zzrq: zzrq 8 } 9 }); 10 }) 11 12 <Table id = "DataGrid" Class = "easyui-DataGrid" Fit = "true" border = "false" toolbar = "# tbar" pagination = "true" 13 Data-Options = "pagesize: 20, pagelist: [10, 20, 30, 40, 50,100,500 0], idfield: 'chjid', sortname: 'chjbh ', queryparams: {'action': 'query '}" 14 Rownumbers = "true" singleselect = "true" url = "../source/jichu/chjdoc. ashx"> 15 <Thead> 16 <Tr> 17 </Tr> 18 </Thead> 19 </Table>
2. Cause Analysis and Solutions
HtmlCodeThe DataGrid is declared using the class, causing easyui to parse the DataGrid in the class declaration first when parsing the class code, so that the component requests a URL and then calls JS initialization code to request a URL. This leads to repeated loading. The solution is to declare the easyui component in only one initialization method to avoid repeated request submission, delete the class declaration (class = "easyui-DataGrid") in HTML. The modified code is as follows:
1<Table id = "DataGrid" Fit = "true" border = "false" toolbar = "# tbar" pagination = "true"213 Data-Options = "pagesize: 20, pagelist: [10, 20, 30, 40, 50,100,500 0], idfield: 'chjid', sortname: 'chjbh '"314 rownumbers = "true" singleselect = "true" url = "../source/jichu/chjdoc. ashx">415 <thead>516 <tr>617 </tr>718 </thead>819 </table>