Transmission of Struts2 and jqGrid parameters, and transmission of struts2jqgrid

Source: Internet
Author: User
Tags jqgrid

Transmission of Struts2 and jqGrid parameters, and transmission of struts2jqgrid


Recently, jqGrid was used in the project to display data. However, I have never understood how data is transmitted. In jqGrid, The rowNum parameter defines how many rows of data are displayed on each page, while in Action, the rows attribute defines the number of rows displayed on each page. Therefore, I have never understood how two parameters are connected.

Today, I found a reasonable explanation on the Internet. The PrmNames option in jqGrid is used to set the parameter name that jqGrid will pass to the Server. By default, rows: "rows" is included. The first rows is taken from rowNum, and the second rows indicates that the parameter "rows" is used when data is transferred to the Server ". Therefore, the rowNum value is passed to the rows attribute in the Server.

If rows: "pageSize" is changed in the PrmNames option, the data value of rowNum is transmitted to the Server using the pageSize parameter, the corresponding Action also requires the pageSize attribute to receive the number of data lines displayed on each page.

The following describes the parameters of the prmNames option and jsonReader option.


PrmNames: {page: "page", 
// parameter name indicating the request page number rows: "rows", 
// parameter name sort: "sidx ", 
// The parameter name of the column name used for sorting order: "sord", 
// The parameter name used for sorting: search: "_ search ",
 // indicates whether the search request parameter name is nd: "nd", 
// indicates the number of times the request has been sent parameter id: "id ", 
// indicates the id used for sending data in the editing data module. The value of the parameter "operation:" operation ",
// operation:" edit ", // when data is submitted in edit mode, the operation name addoper: "add", 
// when data is submitted in add mode, the operation name deltas: "del ", 
// when data is submitted in delete mode, the operation name is subgridid: "id",
 // The data name npage: null when you click to load data to the sub-table, totalrows: "totalrows" 
// parameter name indicating the total number of rows of data to be obtained from the Server. For details, see rowTotal in the jqGrid option}
JsonReader is used to set how to parse json data obtained from the Server.



JsonReader: {root: "rows", 
// The entry in json that represents the actual model data, that is, page: "page ", 
/ total: "total" for the data representing the current page number in json, 
// records: "records" for the data representing the total page number in json ",
// repeatitems: true, which indicates the total number of data rows in json. 
// if it is set to false, when jqGrid parses json, the corresponding data element is searched by name (Elements in json can be searched in different order),
 and the name used is from the name setting in colModel. Cell: "cell", id: "id", userdata: "userdata", subgrid: {root: "rows", repeatitems: true, cell: "cell "}}

Reference: http://blog.csdn.net/lijiangjava/article/details/52170106



Related Article

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.