-
5 Sep 2012 6:36 AM #1
Unanswered: gird paging total is 0, no next page
Unanswered: gird paging total is 0, no next page
hi,
I am trying to adopt paging (ideally infinite scroll, but this stage just pure paging). Backend is spring supported, that accepts start and limit parameter, what is working fine. First page is show, but unable to get next. Stripped out all unnecessary code - I hope
store is having a grouping header, but that all done on server side, nothing to do on clientCode:http://localhost:8080/search.json?crit=my&start=0&limit=3
Loading the grid with its popup window, like this:Code:Ext.define('MyApp.store.Search',{ extend: 'Ext.data.Store', model: 'MyApp.model.Search', groupField: 'teamPrj', sorters: [ { property : 'teamPrj', direction: 'ASC' }, { property : 'name', direction: 'ASC' } ], autoLoad: true, remoteSort: true, buffered: true, pageSize: 100, proxy: { type: 'ajax', url: MyApp.CONTEXT_PATH + '/search.json', reader: { type: 'json', root: 'data', totalProperty: 'total' } } }); Ext.define('MyApp.model.Search',{ extend: 'Ext.data.Model', fields: ['teamPrj', 'isrc' ] });
what's missing?Code:sParams = {crit: my}; var store = Ext.StoreMgr.get('Search'); Ext.Ajax.request({ url: MyApp.CONTEXT_PATH + '/search.json', params: sParams, timeout: 3000, method: 'GET', waitMsg: 'Searching...', scope: this, success: function(response, opts) { var obj = Ext.decode(response.responseText); var store = Ext.StoreMgr.get('Search'); if (obj.success) { console.log('total='+obj.total); store.proxy.totalCount = obj.total; store.loadData(obj.data);
thx,
Zol
-
5 Sep 2012 6:59 AM #2
Hello, i do a basic grid with json store:
Grid:
Store:Code:var grid = Ext.create('Ext.grid.Panel', { title: 'Grid example', store: jsonStore, loadMask: true, columns: [ { text: '...', dataIndex: '...' }, { text: '...', dataIndex: '...' }, { text: '...', dataIndex: '...' } ], bbar: Ext.create('Ext.PagingToolbar', { store: jsonStore, displayInfo: true, displayMsg: 'Displaying topics {0} - {1} of {2}', emptyMsg: "No topics to display" }), });
Model:Code:var jsonStore = new Ext.data.JsonStore({ storeId: 'gridStore', autoLoad: true, pageSize: 20, model: 'resources', proxy: { type: 'ajax', url: 'http://...', reader: { root: '...', totalProperty: '...' } } });
It's work with me, you must just replace "..." by your data (column name of your json for example)Code:Ext.define('resources', { extend: 'Ext.data.Model', fields: [ { name: '...', type: '...' }, { name: '...', type: '...' }, { name: '...', type: '...' } ], idProperty: '...' });
I hope i help you.
Regards,
David
-
5 Sep 2012 1:23 PM #3Sencha - Support Team
- Join Date
- Jul 2010
- Location
- Houston, Tx
- Posts
- 7,185
- Vote Rating
- 194
- Answers
- 433
Here is an example using spring and paging:
http://loianegroner.com/2012/05/extj...e-paging-grid/
If this does not help, I have posted a PHP example online as well.
Scott.
-
5 Sep 2012 11:12 PM #4
thanks Scott,
found many small things. Rightnow I am stage, where first page loaded correct. Total value and page count looks okay. Now the problem is while clicking on Next it shows an empty screen. After some fire-bugging, it looks, my search term is not sent out - parameter: crit.
first page call is this:Code:localhost:8080/search.json?start=100&limit=100&group=[{"property"%3A"teamPrj"%2C"direction"%3A"ASC"}]&sort=[{"property"%3A"teamPrj"%2C"direction"%3A"ASC"}]
Where should the gird contain the mandatory 'crit' field to be ready for re-send.Code:http://localhost:8080/search.json?crit=my&start=0&limit=100
thanks a lot,
Zol
-
6 Sep 2012 12:46 AM #5
issue solved by adding proxy.extraParams

store.proxy.setExtraParam('crit','my');


Reply With Quote