I have a grid with a pagingToolbar in a layout that displays pages of information. It works fine.
I added a function to auto-refresh the data using an idea (http://snippets.scottwalter.com/posts/show/267) found on Scott Walker's site but I am having a problem.
The auto-refresh works OK, but every time it runs it resets to page 1 of the data: because of the params that are specified to the load() method. Is there any way that I can "see" what page the toolbar is displaying in the grid, so that I can alter the value of the start parameter?
Guff
VinylFox
28 Jun 2007, 7:48 AM
paging.getPageData().activePage
tryanDLS
28 Jun 2007, 7:52 AM
You could pull it out the dom node that displays 'page n of x' or you probably call the private getPageData method to get the info - take a look at the source to see what it returns.
matjaz
28 Jun 2007, 8:44 AM
In PagingToolbar you have:
cursor property -> start param
pageSize -> limit param
see its private onClick() method ("refresh" part) for details.
djfloetic
5 Jul 2007, 7:44 AM
paging.getPageData().activePage
Sure it prints out the page that you were on but for some reason,
When I call
ds.load({params:{func: 'viewAll', start:paging.getPageData().activePage, limit:30}});
after I submit a form,
it basically goes to the next page starting at the record you highlighted + 1 and the data is still stale as it is still not updated unless you manually hit the refresh button again or goto next page and come back.
I'm thinking there is an issue with submitting a form AND refreshing a grid at the same time. Seems to not want to work together.
Any ideas?
FYI, this is my submit button:
//Buttons for the submission form
submitButton = fs.addButton({
text: 'Save',
handler: function() {
fs.submit({
url: './includes/database/dbmanager.php?func=appControlModify',
waitMsg: 'Submitting request...',
params:{
id: Ext.get('bcdbview-details-id').dom.innerHTML,
option: appControlComboBox.getValue()
}
});
// Refresh the grid view with new data
ds.load({params:{func: 'viewAll', start:0, limit:30}});
//alert(paging.getPageData().activePage);
},
disabled: true
});
This is the code of my paging toolbar:
var gridFoot = grid.getView().getFooterPanel(true);
var paging = new Ext.PagingToolbar(gridFoot, ds, {
pageSize: 30,
displayInfo: true,
displayMsg: 'Displaying items {0} - {1} of {2}',
emptyMsg: "No items to display"
});
// add the detailed view button
paging.add('-', {
pressed: false,
enableToggle:true,
text: 'Detailed View',
cls: 'x-btn-text-icon details',
toggleHandler: toggleDetails
});
// trigger the data store load
ds.load({params:{func: 'viewAll', start:0, limit:30}});
ds.baseParams.func = "viewAll";
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.