Request URL two times when the DataGrid is initialized
Two cases
1.
<id= "GridView" class= "Easyui-datagrid"></ Table >
$(function(){ $("#gridview"). DataGrid ({URL:"Getdata.do", Title:List, Singleselect:false, pagination:true, toolbar:"#toolbar", Method:"Get", columns:[[{field:"CK", checkbox:true}, {field:"id", Title: "id", width:20,sortable:true}, {field:"Kindname", Title: "Name", Width:100,resizable:true, sortable:true}, {field:"CreateDate", Title: "Date Created", Width:80,resizable:true, sortable:true} ]] }); })
Because the table in the grid is written class= "Easyui-datagrid", in addition to the initialization of JS has a URL so that it will request two times getdata.do, will class= "Easyui-datagrid" removed.
Second case:
$ (function() {
$ ('. Sfc7450_main_table1 '). DataGrid ({url: ' Table.json ',//load local jsonrownumbers:true,//If the serial number is displayed pagination:true,// Whether to add tab pageposition: ' Bottom ',//Page location method: ' Get ',//Get type singleselect:true,//whether Radio fitcolumns:false,// Whether the cell is self-adapting to fill the table width columns:[sfc7450_table[0]]});
});
$ ('. Sfc7450_main_table1 '). DataGrid ({url: '/sfc/a.do ',//load local jsonrownumbers:true,//If the serial number is displayed pagination:true,// Whether to add tab pageposition: ' Bottom ',//Page location method: ' Get ',//Get type singleselect:true,//whether Radio fitcolumns:false,// Whether the cell is self-adapting to fill the table width columns:[sfc7450_table[0]]});
This time there will be a strange phenomenon: JS debugging observation Network will see the request sfc/a.do. After the request is completed and then requested a table.json ... WORKAROUND: Instead of requesting a URL at initialization time, use data to assign an empty array (why do we initialize an empty table for the page to look good at the beginning)
Blank josn 5 row var kongjson5=[{"": "", "": "," "" "," "", "", "" "", "" "" "," "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ,"":"","":"","":"","":"","":"","":""},{"":"","":"","":"","":"","":"","":"","":"","":"","":"","":""},{"":"","":" ","":"","":"","":"","":"","":"","":"","":"","":""},{"":"","":"","":"","":"","":"","":"","":"","":"","":"","":""} ]
Change to the following $ ('. Sfc7450_main_table1 '). DataGrid ({
data:kongjson5,//loading Local JSON
rownumbers:true,//serial number Shows whether pagination:true,//add tab pageposition: ' Bottom ',//Page location method: ' Get ',//Get type Singleselect: true,//whether the radio fitcolumns:false,//cell is self-adapting to fill the table width columns:[sfc7450_table[0]});
<table id="GridView" class="Easyui-datagrid"> </table>
Easyui DataGrid loads two requests, triggering two AJAX request issues