PDA

View Full Version : PagingToolBar - pageSize and dynamic height



silve69
12 Oct 2009, 12:12 PM
Hello friends,

I want to recalculate the showed rows when the grid is resized... I'm trying the follow code inside a grid panel:



<<< more code here >>>
bbar: [{
xtype: 'paging',
border: false,
pageSize: maxRowsPerGrid,
store: viewCandidates_store,
displayInfo: true,
}],
listeners: {
bodyresize: function(panel, width, height) {
var contentHeight = height-24; // eliminating header
var rowHeight = 22;
maxRowsPerGrid = Math.round(contentHeight/rowHeight);
var tmp_bbar = this.getBottomToolbar();
tmp_bbar.pageSize = maxRowsPerGrid;
this.store.load();
},
<<< more code here >>>

When I resized the grid the event is sent, but nothing happen with the rows showed.
What is wrong with the code???

Best regards,
Silver

silve69
12 Oct 2009, 12:49 PM
Hello again,

With the follow changes, the rows per grid are changing correctly, but pages not.



bodyresize: function(panel, width, height) {
var contentHeight = height-24;
var rowHeight = 22;
maxRowsPerGrid = Math.round(contentHeight/rowHeight);

this.store.baseParams = this.store.baseParams || {};
this.store.baseParams['limit'] = maxRowsPerGrid;

var tmp_bbar = this.getBottomToolbar();
tmp_bbar.pageSize = maxRowsPerGrid;
var o = {start:0};
this.store.reload({ params:o });
}

countdown
1 Jun 2010, 1:40 AM
Thanks for the code! with a quick fix it works great
You've probably already found the problem, but if anyone is looking for it:

instead of

this.store.reload({ params:o });
reload the pagingtoolbar!

tmp_bbar.doLoad(tmp_bbar.cursor);