About the Grid of ExtJs4 with query parameter pagination (baseParams -- & gt; extraParams), extjs4extraparams

Source: Internet
Author: User

About the Grid of ExtJs4 with query parameter pagination (baseParams --> extraParams), extjs4extraparams

(There are many articles in the garden, which are named ExtJs GridPanel + query condition + paging. However, after the query condition is added, click the next page. The query condition is invalid. Please test it and try again.

Don't mislead new people like me .)

ExtJs6 is released, and ExtJs4 is not new. The first thing to talk about is whether there is any attribute or method change in 5.x and 6.x. I'm not sure.

In the proxy of ExtJs4, there is no baseparams attribute. What does ExtJs4 become?

I checked a lot of Chinese Blogs and found no results. I finally saw a piece of English:

You need to use the 'extraparms' proxy property in place of the baseParams one from Ext 3. An equivalent JsonStore in ExtJS 4.

The answer is clear, instead of extraParams.

Problem description:

For example, if the original data load is 100 pages, the query does show 7 pages, but clicking the next page turns into the second page of 100 pages. I think this must be a very common problem.

Solution:

Add attributes to your store proxy

Var mystore = Ext. create ('ext. data. store', {fields: ["RoleID", "RoleName", "CreateTime", "ModifyTime", "ModifyAdmin", "DelFlag"], // "CreateAdmin" pageSize: 15, // page capacity bar data // whether to sort data on the server (if true, it cannot be sorted on the client) remoteSort: false, remoteFilter: true, proxy: {type: 'ajax ', url: "/AdminArea/AdminRole/GetRoleListJson", // extraParams: {// showDel: $ (' # hiddenDelflag '). val () //}, reader: {// here, reader is the place of the Data Storage Organization The following configuration is json data, for example: [{"total": 50, "rows": [{"a": "3", "B ": "4"}] type: 'json', // The returned data type is json format root: 'rows ', // data totalProperty: 'Total' // total number of data records}, extraParams: {showDel: 'true' }}, sorters: [{// sorting field. Property: 'roleid', // sorting type. The default value is ASC // ction: 'desc'}], autoLoad: true // load data instantly });

 

When the condition you want to query or filter is ---- do not display the information in the recycle site ---- you just want

Refresh the table with showDel: false. When you flip the page, the information in the recycle site is still not displayed.

How to keep this parameter always exists is the above method.

If you see other articles that tell you to use baseParams, replace it with extraParams in Ext4.

 

Extension:

Then how to dynamically obtain the showDel attribute and modify it. The following code will give you an answer,

Var proxy = mystore. getProxy (); proxy. extraParams. showDel = false; // obtain and modify mystore. load ();

 

In this way, showDel is false no matter how you flip the page, unless you change the parameter again;

 

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.