Generally, the basic attributes of a jqgrid are commonly used.
CopyCode The Code is 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 {1 ",
Pgbuttons: True,
Autoheight: True,
Rownumbers: false, // whether to display the number of rows
Pgbuttons: True, // whether the pagination button is displayed
Pginput: True, // whether the number of pages allowed to be input
Scrollrows: false, // whether the row scroll bar is displayed
Viewrecords: True, // whether to display the total number of records
Multiselect: True, // whether to display the check box
Recordpos: "Left", // location where the number of records is displayed
Sortorder: "ASC", // sorting method
Pager: "# pager"
)}
If you do not want to execute the table initialization method during initialization, you must set the URL to null and the ype to "local". Otherwise, a JS error occurs, the button on the page does not work.
If you need to initialize the table at the beginning, you need to set the URL value. net MVC Architecture, that is, the format "/controller/Action/", the first "/" is required, otherwise it cannot enter the background action, the last "/" does not seem to be necessary. It is generally added. After setting the URL, you must also note that datatype must match the data type of postdata. Otherwise, an error may occur. For example, if datatype: "JSON", postdata must be a JSON object.
If you want to perform table initialization dynamically, you do not need to set the URL value at the beginning. datatype is set to "local" (otherwise, an error is reported ). Then, the jqgrid initialization action is triggered dynamically.
For example, the Code is as follows:Copy codeThe Code is 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 the URL of the table
Datatype: "JSON", // sets the Data Type
Postdata: {strjson: coursedata}
});
In this way, you can dynamically display table data.