Generally, a basic attribute of a jqgrid has a few common ones.
Copy Code code as follows:
$ ("#id"). Jqgrid ({
URL: "",
DataType: "Local",
PostData: {Strjson:data},
Mtype: "Post",
HEIGHT:45,
WIDTH:450,
Rownum:rum,//number of records per page
Pgtext: "{0} page total {1} page",
Pgbuttons:true,
Autoheight:true,
Rownumbers:false,//whether to display the number of rows
Pgbuttons:true,//page pagination button is displayed
Pginput:true,//whether to allow paging pages
Scrollrows:false,//whether to display row scroll bars
Viewrecords:true,//whether the total number of records is displayed
Multiselect:true,//whether to show check boxes
Recordpos: "Left",///record number display location
SortOrder: "ASC",//sorting method
Pager: "#Pager"
)}
In the initialization, if you do not want to perform the initialization method of the table, you need to set the URL is empty, datatype set to "local", otherwise there will be a JS error, resulting in the page button buttons do not work.
If you need to perform initialization of the table at the beginning, you need to set the value of the URL, in a format like "/controller/action/" under the. NET MVC framework, the first "/" is required, otherwise it is not possible to enter the back-end action, and the last "/" It's not necessary, it's usually added. After setting the URL, also note that the problem is datatype to match the PostData data type, otherwise there will be errors. For example, datatype: "JSON," then PostData needs to pass the JSON object.
If you want to dynamically perform the initialization of the table, you can start by not setting the URL value, datatype set to "local" (otherwise the error). Then dynamically triggers the initialization action of the Jqgrid.
For example, after double-clicking in a table, you trigger the code as follows:
Copy Code code as follows:
Double-click a row event
Ondblclickrow:function () {
Coursedata = Json.stringify ({
Stunum:studentnum,
Rownum:rum,
Page:1
});
JQuery ("#courseInfoGrid"). Jqgrid ("Setgridparam", {
URL: "/personalarrearssettlement/getstudentcourseinfo",//Set URL of the table
DataType: "JSON",//Set data type
PostData: {Strjson:coursedata}
});
This allows you to dynamically display the data for the table.