jquery to dynamically display Jqgrid and Jqgrid property settings are easy to solve problems _jquery

Source: Internet
Author: User
Tags jqgrid
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.