Disabling extra Sencha ExtJS and Touch REST URL parameters

When you first work with a Sencha ExtJS or Touch Store and Proxy, you’ll quickly find that when you create GET and POST REST services, by default the store/proxy adds extra parameters to the end of the URLs you’re accessing.

For instance, very early on you’ll see that Sencha adds a parameter named _dc to your URLs. The name “dc” stands for “disable cache”, and while it can be a good thing, it’s also surprising at first. More than that, it can create problems because the REST web service you’re accessing may not be expecting those parameters.

With Sencha ExtJS and Touch you can disable the _dc parameter and all of the other parameters that Sencha adds to your URLs. The following example Store code shows how to disable all of the URL parameters that Sencha adds:

Ext.define('Radio.store.RadioStations', {
    extend: 'Ext.data.Store',
    requires: 'Radio.model.RadioStation',
    model: 'Radio.model.RadioStation',

    proxy: {
        type: 'ajax',
        url: '/radio/data/radioStations.json',
        method: 'GET',
        reader: {
            type: 'json'
        },
        
        // get these parameters out of the GET url
        // ---------------------------------------
        noCache: false,
        limitParam: undefined,
        pageParam: undefined,
        startParam: undefined,
    }

});

These lines in particular are the ones that disable the extra parameters that Sencha adds to your REST URLs:

noCache: false,          // gets rid of '_dc'
limitParam: undefined,   // gets rid of 'limit'
pageParam: undefined,    // gets rid of 'page'
startParam: undefined,   // gets rid of 'start'

There are definitely times when you want these parameters -- and when you’ll want to control them even more -- but when you just want to get rid of them, this is how you do it.