How to stop ext-js from adding limit = 25 to my JSON request?

The following code works. The problem is that the request is sent with & _dc = 1299207914646 & limit = 25 added to each request sent to the server. Nothing I can do changes the limit = 25. Ideally, I do not want to add additional parameters to the server. I would do, however, with the ability to set a limit of up to 10,000 or something like that. I can add other parameters, but nothing removes the restriction = 25. I would also like to get rid of the & _dc parameter, although I do not know why it was added, this does not cause a problem.

Any ideas?

Note: some weird issue with formatting the code below?

thanks

Ext.require([ 'Ext.grid.*', 'Ext.data.*', 'Ext.panel.*' ]); Ext.onReady(function(){ Ext.regModel('Image_', { // window.Image is protected in ie6 !!! fields: ['id', 'key', 'value'] }); var store = new Ext.data.JsonStore({ model: 'Image_', proxy: { type: 'ajax', var store = new Ext.data.JsonStore({ model: 'Image_', proxy: { type: 'ajax', autoload: 'false', url: '/couchdb/test/_design/blah/_view/by_surname2?startkey=%22r%22&endkey=%22r\u9999%22', reader: { type: 'json', root: 'rows' } } }); store.load(); var listView = new Ext.grid.GridPanel({ width:425, height:250, collapsible:true, title:'Simple ListView <i>(0 items selected)</i>', renderTo: Ext.getBody(), store: store, multiSelect: true, viewConfig: { emptyText: 'No images to display' }, headers: [{ text: 'File', flex: 50, dataIndex: 'value' },{ text: 'Last Modified', flex: 35, dataIndex: 'key' },{ text: 'Size', dataIndex: 'id', flex: 15, cls: 'listview-filesize' }] }); // little bit of feedback listView.on('selectionchange', function(view, nodes){ var l = nodes.length; var s = l != 1 ? 's' : ''; listView.setTitle('Simple ListView <i>('+l+' item'+s+' selected)</i>'); }); }); 
+6
javascript extjs
source share
8 answers

In your proxy set

 limitParam: undefined, pageParam: undefined, startParam: undefined, noCache: false, 
+8
source share

You can change your store limit when loading a store.

 store.load({params:{limit:50}}); 

In this case, I ask you to set the limit to 50. _dc = 1299207914646 - a unique cache boost parameter added to GET requests. If you do not want to have them in the URL, you can disable them by setting the disableCaching parameter to false.

But I would recommend that you set the storage method to POST and pass the parameters using the POST method, not GET. This way you can have clean URLs as well as hide sent data.

+4
source share

add the limit property to your store ...

  limit:50, 

and may not hurt the attempt to draw ....

  pagesize:50 

and see if that helps.

Edit: also try

  pageParam:undefined, 

in your proxy.

found that last piece of ...

http://www.sencha.com/forum/showthread.php?118445-CLOSED-1.0.1-Ext.data.JsonStore-quot-limit-quot-param-issue

+1
source share

You must set the save option

 pageSize : 10 

In response to the comment. The store should look like this:

 var store = new Ext.data.JsonStore({ pageSize : 10, //10-number of json objects model: 'Image_', proxy: { type: 'ajax', autoload: 'false', url: '/couchdb/test/_design/blah/_view /by_surname2?startkey=%22r%22&endkey=%22r\u9999%22', reader: { type: 'json', root: 'rows' } } }); 
+1
source share

You can override the getParams Ext.data.proxy.Server method.

For example, in my project, I added a custom logical parameter embeddedParams , and if I do not want to add ExtJS parameters to the request, I set it to false in the proxy storage:

 /** * Added embeddedParams option */ Ext.define('Ext.lib.overrides.ServerProxy', { override: 'Ext.data.proxy.Server', /** * Add or not pagination, grouping, sorting and filtering parameters to the request. Defaults to true. */ embeddedParams: true, /** * @private * Copy any sorters, filters etc into the params so they can be sent over the wire */ getParams: function (operation) { var me = this, params = {}, isDef = Ext.isDefined, groupers = operation.groupers, sorters = operation.sorters, filters = operation.filters, page = operation.page, start = operation.start, limit = operation.limit, simpleSortMode = me.simpleSortMode, simpleGroupMode = me.simpleGroupMode, pageParam = me.pageParam, startParam = me.startParam, limitParam = me.limitParam, groupParam = me.groupParam, groupDirectionParam = me.groupDirectionParam, sortParam = me.sortParam, filterParam = me.filterParam, directionParam = me.directionParam, hasGroups, index; if (me.embeddedParams && pageParam && isDef(page)) { params[pageParam] = page; } if (me.embeddedParams && startParam && isDef(start)) { params[startParam] = start; } if (me.embeddedParams && limitParam && isDef(limit)) { params[limitParam] = limit; } hasGroups = me.embeddedParams && groupParam && groupers && groupers.length > 0; if (hasGroups) { // Grouper is a subclass of sorter, so we can just use the sorter method if (simpleGroupMode) { params[groupParam] = groupers[0].property; params[groupDirectionParam] = groupers[0].direction || 'ASC'; } else { params[groupParam] = me.encodeSorters(groupers); } } if (me.embeddedParams && sortParam && sorters && sorters.length > 0) { if (simpleSortMode) { index = 0; // Group will be included in sorters, so grab the next one if (sorters.length > 1 && hasGroups) { index = 1; } params[sortParam] = sorters[index].property; params[directionParam] = sorters[index].direction; } else { params[sortParam] = me.encodeSorters(sorters); } } if (me.embeddedParams && filterParam && filters && filters.length > 0) { params[filterParam] = me.encodeFilters(filters); } return params; } }); 

Using:

 store: Ext.create('Ext.data.Store', { ... proxy: { ... type: 'ajax', // or 'direct', 'jsonp' / 'scripttag' embeddedParams: false } }) 
+1
source share

You can change the limit parameter with

 store.proxy.limitParam=null; 
0
source share

To remove the _dc parameter on extjs 4, you can set:

 noCache: false 

or just uncheck if you are using architecture 2.

0
source share

In particular, for Json , to get rid of the _dc parameter, in your proxy object, set the configuration parameter set by Tharahan:

 proxy: { type: 'ajax', api: { read: 'app/data/something.json', update: 'app/data/something.json' }, reader: { type: 'json', ... }, writer: { type: 'json', ... }, noCache: false } 

EDIT: (sorry, I did not look at the publication date, but lost so much time). Note that the global Ext.Loader.setConfig({disableCaching: false}); does not affect the subclasses of Ext.data.proxy.Server that need this particular option (at least in development with sencha touch 2.2.0).

0
source share

All Articles