So far i was able to set
'disableCaching: false'
in Ext.Loader.config(in app.js) and debug extjs applications on chrome browser.
But now, on inspecting the source, i see that the files have filename.js?dc=1123123 and every time the files are fetched from remote and not cached. So i am unable to set breakpoints and debug run-time on browser.
Please note that this scenario is when i do a browser refresh.
Plz let me know how i can resolve this issue.
Set disableCacheing to false in app.js before Ext.application({...
Ext.Loader.setConfig({
disableCaching: false
});
This will remove _dc cache param from requests that are getting files.
For disabling _dc on XHR Ext.Ajax requests use
Ext.Ajax.disableCaching = false;
And for proxy communication with server use noCache property on Ext.data.proxy.Server class.
noCache: true
You can also set cache config in app.json file.
"loader": {
// This property controls how the loader manages caching for requests:
//
// - true: allows requests to receive cached responses
// - false: disable cached responses by adding a random "cache buster"
// - other: a string (such as the build.timestamp shown here) to allow
// requests to be cached for this build.
//
"cache": "${build.timestamp}",
// When "cache" is not true, this value is the request parameter used
// to control caching.
//
"cacheParam": "_dc"
}
Also if using Chrome Dev Tools for debugging take a look at disableCache on Networks tab and if using FF use CTRL + F5 insted F5 to reload page
Add ?cache=false to the end of your URL to temporarily disable caching on a per-request basis.
Setting Ext.Loader configuration is one thing. There is also something called Ext.Boot which is used before loader is up and running. Boot has his own disableCaching setting. It defaults to something like this:
disableCaching: (/[?&](?:cache|disableCacheBuster)\b/i.test(location.search) ||
!(/http[s]?\:/i.test(location.href)) ||
/(^|[ ;])ext-cache=1/.test(doc.cookie)) ? false :
true,
Probably files with dc appended to url are loaded by Boot. If you want to disable it permanently just replace this code and set it to false.
app.json:
"loader": {"cache": true},
then:
sencha app refresh
it may seem confusing, but the _dc parameter then won't be present anymore - at all.
I just don't understand how ExtJS is building these routes, or how I can stop all of it.
For example, if I'm using a proxy like:
{
type: 'rest',
url: '/user',
noCache: false,
reader: { type: 'json', successProperty: 'success' }
}
I would expect requests like GET /user or POST /user/123 as is the case with restfull apis.
Instead I get stuff like GET /user/root?node=root or GET user?page=1&start=0&limit=25.
Is there a way to get ExtJS to stop adding all these extra params?
The tree store defines a default root id if you don't care of that yourself.
The page and start params are added by the paging toolbar in the grid. Your REST implementation should not be bothered by extra parameters. You can also disable them if you turn paging off.
I am adapting a tutorial to change from localstorage to use a java servlet but i am having some problems. I am trying to update the changes a user makes by calling sync() but i am getting these errors.
[WARN][Ext.data.Operation#process] Unable to match the record that came back from the server.
I tried seeing if the updated values where being send to the servlet
String name = request.getParameter("name");
is null. How do I send the updated values back the server and read them? I tried looking for a sencha touch + servlets tutorial but can't find anything
this is my sync code
var showsStore = Ext.getStore("Shows");
if (null == showsStore.findRecord('name', currentShow.data.name)) {
showsStore.add(currentShow);
}
showsStore.sync();
The expected return for a store sync is an array of JSON records, or nothing.
Add this to your data store
writer: {
type: 'json',
rootProperty: 'data',
encode: true,
writeAllFields: true
},
im near to finish my app and when try to put in onlin server i find some problems...
My proxy don't work with ajax issue, i need to put jsonp and configure my drupal to use JsonP.
Before:
proxy: {
type: 'ajax',
url: 'http://mydomain/json-art',
reader: {
type: 'json',
rootProperty: 'nodes'
},
}
After:
proxy: {
type: 'jsonp',
url: 'http://mydomain/json-art',
callbackKey: 'callback',
reader: {
type: 'json',
rootProperty: 'nodes'
},
}
Then in Drupal 7 put... JsonP prefix: Ext.data.JsonP.callback1
And.. all works fine.
But.. I have 4 Stores in my app, and try to reply this configuration in my other stores. And only works for the first one. I try to change the callback1 to callback2, callback3, etc.. but always have the same error:
Object [object Object] has no method 'callback4'
I don't know whats the correct way to use callbackKey in my app, pls help me!!!!
Thx
What I figure from "the internet", the drupal JSONP Prefix is either a set string to use, or the name of the url variable to check. If you set the JSON Prefix to "callback", it should work fine. This is because the the Sencha JsonP call will auto-append a url parameter named "callback", which contains the name of the function to call (typically Ext.data.JsonP.callback#number#.
Note that your solution is not even right for one datastore. Not entirely sure why you get the behaviour you get, but each JsonP call should have a different callback functionname.
There is no need to specify a callback (if it's even possible, not sure) in a proxy. Just get rid of the 'callbackKey' param and it should work. Sencha automatically places a callback parameter when using jsonp.
Using Ext, default Ext.Ajax add to GET-request _dc parameter. For example
GET /ConnViewProcessing/?_dc=1263286227619
How to remove this parameter?
PS: it's necessary to manually cache response to ETag and If-None-Match.
Set disableCaching option to false:
Ext.Ajax.disableCaching = false;
Using Ext JS 4.1, and after adding the following code to app.js, the _dc parameter disappears:
// Disable _dc parameter
Ext.Loader.setConfig({
disableCaching: false
});
// My App
Ext.application({
The proper way to accomplish that with Sencha Cmd 6.x is to set a (global) switch in app.json (because all of those hacks and overrides might interfere unnecessarily with the functionality):
"loader": {
"cache": true
},
Then run sencha app refresh, in order to update the application's bootstrap.json.
Alternatively, one can configure Ext.Loader (at run-time):
Ext.Loader.setConfig({disableCaching: false});
When scrolling upwards and reading the actual question, concerning Ext.Ajax (per request):
Ext.Ajax.request({url: '/ConnViewProcessing', disableCaching: false});
The result: no more _dc parameters on scripted requests.
#see Sencha Cmd 6.x - The Microloader.
Note that the use of Ext.Loader has changed in ExtJS 5.
In ExtJS 5, caching can be disabled:
temporarily by adding "?cache" to the end of the URL
by setting a cookie called 'ext-cache' with the value of 1
or by editing the file .sencha/app/Boot.js and setting the '_config.disableCaching' property to be true (overwriting the dynamic lookup).
I am using ExtJS 4.2, but this should work for Ext JS 4.1 and on. In the proxy there is a property called noCache you should set this to false.
Ext4.define('Server',{
extend: 'Ext4.data.Model',
fields: [
{name: 'id'},
{name: 'key'},
{name: 'value'}
],
proxy: {
type: 'rest',
url : 'yaddayaddayadda',
noCache: false,
reader : {
type: 'json'
}
}
});
The reason my code says Ext4. is because I am using the sandbox mode as I move old Ext JS 3x code into 4.2
This should work with extjs 4.0.7:
Ext.Loader.config.disableCaching = false;
Setting the flag disableCaching to false (double negation - yay!) on the Ext.data.Connection should do the trick.
For more, look at the disableCaching-documentation.
(Please note that quite a few classes in Ext seem to have the option available, so you might have to muck around a bit.)
For those that want to set "disableCaching: false" in Sencha Architect 3+, here is how..:
In the project inspector window, select the top node,
"Application"
Then in the "Config" window below that where you
set the object properties, etc, select "Loader Config".. in my case
I had to click the "+" to the right of this as I hadn't set any
items yet. This will create a new "LoaderXX" object in the "Project
Inspector" window above; Loader25 in my case.
Now either select the new object in the
"Project Inspector" window, or click on the right arrow beside the
new "LoaderXX" (Loader25 in my case). This will take you to the
properties for the object.
Untick the "disableCaching" item.
Save the project and refresh the browser window, and enjoy persistent breakpoints, etc, etc in Chrome.
The only way I was able to disable _dc in ExtJS 4.2.x globally on my project:
Ext.define('Ext.data.Connection', {override:'Ext.data.Connection', disableCaching:false });
Ext.define('Ext.data.proxy.Server', {override:'Ext.data.proxy.Server', noCache:false });
Ext.define('Ext.data.JsonP', {override:'Ext.data.JsonP', disableCaching:false });
This is ugly, but any other ideas?
This is how I did this:
Ext.Ajax.request({
url: url,
disableCaching:false
});
I decided that I wanted the cache to be destroyed client side, but server side I was using my own caching mechanism (PHP's APC).
I left the _dc in the Ext ajax request, but then removed it from the REQUEST_URI, and then use the REQUEST_URI as the basis for the cache key
I found this useful: Regular expression to remove one parameter from query string
If you develop under Sencha CMD you can do like this
http://localhost:1841/?disableCacheBuster
or just
http://localhost:1841/?cache
For all who are looking for a way to disable it in a newer version:
proxy: {
type: 'ajax',
noCace: false
}
I use Ext.NET on top of Ext.JS. It adds some more voodoo to Ext.js...
I tried to get rid of the dc= parameter, but all mentioned configurations did not work. So, this is my uber-effective, uber-dirty solution:
Ext.Date.now = function () { return ""; }
As far as I can see, Ext.Date.now() is only used for the caching logic. So it should be relativity save.