-
22 Feb 2009 7:48 PM #31
I also can not make the paging to work when the page loaded for the first time, any solution for this yet? or am i doing something wrong here :
LGjsonReader=new Ext.data.JsonReader({
root: 'rootLeague',
totalProperty:'totalCount',
id: 'ModuleId'
},[
{name: 'ModuleId'},
{name: 'ModuleName'},
{name: 'Selected'}
]);
.................
leagueStore = new Ext.ux.data.PagingStore({
proxy: new Ext.data.HttpProxy({method:'post', url:'rManageOddsSel.aspx?m=league'+pars})
,sortInfo: {
field: 'Selected',
direction: "DESC"
}
, reader: LGjsonReader
,lastOptions: { params: { start: 0, limit: 12} }
});
LGcolModel = new Ext.grid.ColumnModel([
{id:"ModuleId", header: "ID", width: 100, dataIndex: 'ModuleId',hidden:true},
{header: "", width: 50, renderer:putLgCheckBox, dataIndex: 'Selected',align:'center'},
{header: "Module Name", width: 700, dataIndex: 'ModuleName'}
]);
........
},{
xtype: 'grid',
store: leagueStore,
colModel:LGcolModel,
height:500,
width:785,
title:'Select Leagues',
id:'lg_mt_Grid'
,bbar: new Ext.PagingToolbar({
pageSize: 12,
store: leagueStore
})
please help me
-
22 Feb 2009 8:03 PM #32
i got it from another thread

paging_store.load({params:{start:0, limit:5}});
http://extjs.com/forum/showthread.php?t=60757
everything's fine now
thanks alot
-
18 Mar 2009 3:15 PM #33
Hi Condor,
I'm trying to submit a form and load the PagingStore with the Records in the action.result.
The grid remains empty, but once I click the refresh button in the Toolbar, the grid loads properly.
I'm assuming I am not properly loading the store. Can you assist me?
Code:listeners: { searchForResults: function(){ searchCriteriaPanel.getForm().submit({ url: '/TEST/employee_search.hra', method: 'POST', success: function(f, a){ //alert(a.result); searchResultsGrid=createSearchResultGrid(); searchResultsGrid.getStore().loadData(a.result, true); searchResultsGrid.getStore().applyPaging(); searchResultsGrid.getStore().fireEvent('datachanged', searchResultsGrid.getStore()); }, failure: function(f, a){ Ext.Msg.alert('Warning', a.failureType); } }); },
-
18 Mar 2009 10:58 PM #34Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
Do you really want to append the records? Otherwise you can simply use:
ps. You might need to reset paging to the first page before loading by changing lastOptions, e.g.Code:searchResultsGrid.getStore().loadData(a.result[s]);
Code:store.lastOptions.params = Ext.applyIf({start: 0, limit: pagingToolbar.pageSize}, store.lastOptions.params);Last edited by Condor; 19 Mar 2009 at 2:58 AM. Reason: Fixed
-
19 Mar 2009 2:36 AM #35
Thanks Condor, I'll try it out as soon as I hit the office.. And no, I do not want to append, but I figured the first time it would not matter.
Code:searchResultsGrid.getStore().loadData(a.result); searchResultsGrid.getStore().lastOptions)= Ext.applyIf({start: 0, limit: pagingToolbar.pageSize}, store.lastOptions);
-
19 Mar 2009 2:55 AM #36Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
The code I posted wasn't correct. It should have been:
Code:if(searchResultsGrid.getStore().lastOptions){ searchResultsGrid.getStore().lastOptions.params = Ext.applyIf({start: 0, limit: pagingToolbar.pageSize}, store.lastOptions.params); } searchResultsGrid.getStore().loadData(a.result);
-
19 Mar 2009 4:57 AM #37
-
19 Mar 2009 7:08 AM #38Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
Try this:
Code:if(!searchResultsGrid.getStore().lastOptions){ searchResultsGrid.getStore().lastOptions = {}; } searchResultsGrid.getStore().lastOptions.params = Ext.applyIf({start: 0, limit: pagingToolbar.pageSize}, store.lastOptions.params); searchResultsGrid.getStore().loadData(a.result);
-
19 Mar 2009 7:20 AM #39
Condor, I looked at your code for the loadData method in the PagingStore class
I see that you are copying the the lastOptions and baseParams with Ext.apply so I added start and limit to the baseParams of my PagingStore instantiation and this has worked.Code:loadData : function(o, append){ this.isPaging(Ext.apply({}, this.lastOptions, this.baseParams)); var r = this.reader.readRecords(o); this.loadRecords(r, {add: append}, true); }
Is this an ok approach? If so, sorry for not posting that code...
My code as of now:
PagingStore creation
My form submit eventCode:var pagingStore= new Ext.ux.data.PagingStore({ baseParams: { start: 0, limit: 20 }, proxy: new Ext.data.HttpProxy({url: '/HRA/employee_search.hra'}), reader: new Ext.data.JsonReader({totalProperty: 'resultSize', root: 'rows', id: 'employeeId'}, ['employeeName', 'group', 'function', 'employeeId']) });
Also, when I submit the form again, would I have to delete the lastParams in order to get a fresh set of data? Or your piece of code which copies over the the original last options and that will fire the "datachanged" event?Code:searchForResults: function(){ searchCriteriaPanel.getForm().submit({ url: '/HRA/employee_search.hra', method: 'POST', success: function(f, a){ searchResultsGrid=createSearchResultGrid(); if(searchResultsGrid.getStore().lastOptions){ searchResultsGrid.getStore().lastOptions.params = Ext.applyIf({start: 0, limit: 20}, searchResultsGrid.getStore().lastOptions.params); } searchResultsGrid.getStore().loadData(a.result, {start: 0, limit: 20}); var tabPanel=cardContainer.items.itemAt(0); tabPanel.add(searchResultsGrid); tabPanel.setActiveTab(searchResultsGrid); tabPanel.doLayout(); cardContainer.doLayout(); viewport.doLayout(); }, failure: function(f, a){ Ext.Msg.alert('Warning', a.failureType); } }); }
Thanks again for helpingCode:if(searchResultsGrid.getStore().lastOptions){ searchResultsGrid.getStore().lastOptions.params = Ext.applyIf({start: 0, limit: 20}, searchResultsGrid.getStore().lastOptions.params); }
-
20 Mar 2009 3:54 AM #40
regarding fix
regarding fix
I can confirm your fix doesn't work for the paging toolbar.Code:store.applyPaging(); store.fireEvent('datachanged', store);
Two problems I've noted while using store.filter:
1. Page count always keeps the same as well as total records count on the paging toolbar.
2. Store shows current empty page instead of navigating to 1st page (if I filter 1 record for example)
you fix seems to always show the same 1st page - nothing else.
maybe additional even - "filterapplied" should be implied somehow, because I'm not sure if filtering is similar to data-changing in this case?
any more solutions?



Reply With Quote