Ext2.0 upgrade to Ext2.1 Ext.panel Ajax loading method autoload parameter usage changes

Source: Internet
Author: User
Tags autoload

Ext2.0.2 upgrade to 2.1, development should also keep pace with the times. Although this directly replaces 2.0.2, it is a minor problem. The ExtJs panel's remote page loading is a very good feature, and some of the previous calling codes failed to display the most recent data in 2.1.

API DOC says:

Ext.Panel.autoLoad

A valid URL spec According to the Updater Ext.Updater.update method. If AutoLoad is not NULL, the panel would attempt to load its contents immediately upon render.
The URL would become the default URL for this panel's BODY element and so it may is refreshed at any time.

Although it is said to be "refreshed at no time", but in 2.1, the IE did not refresh. As we all know, ie under the AJAX load data has a problem, is the same address to take the second time is cached data. 2.1 did not flush the cache, it must be related to this, so I asked the URL at the end of a time series parameters, the page can be refreshed.

Light to solve the problem is not enough to see the source of the changes in what places it:

Since it is Ext.Updater.update method, then in Ext-all-debug find this code, 2.0.2 inside a more than one prepareurl call, as follows:

Method = Method | | (params?) "POST": "Get");
if (method = = "Get") {
url = this.prepareurl (URL);
}

The code for Prepareurl is as follows:

Prepareurl:function (URL) {
if (this.disablecaching) {
var append = "_dc=" + (new Date (). GetTime ());
if (Url.indexof ("?")!==-1) {
URL + + "&" + append;
}else{
URL + "?" + Append;
}
}
return URL;
},

It seems to me to be right, but also using a time series to distinguish each request. But Ext2.1 does not have this call, the tracking code found directly using Exe.Ajax.disableCaching to judge, by the autoload of the NoCache to the object to control, before lazy only wrote the URL and scripts attributes, Ext2.0 version directly judge get on the E Xt. Updater.update in processing, so can not write nocache, and 2.1 but unified by Exe.Ajax.request to deal with, therefore, must write Nocache:true.
That

{
Xtype: ' Panel ',
Id:node.attributes.idIndex,
Title:node.text,
Iconcls: ' Tabs ',
Closable:true,
AutoLoad: {url:disabledcacheurl, nocache:true, scripts:true}
}

Therefore, the final or straight Tim Nocache:true, simple and convenient.

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.