PDA

View Full Version : When adding additional toolbars to a grid panel, grid body not resizing correctly



bittercoder
17 Apr 2011, 7:51 PM
I'm having a problem when adding an additional toolbar to a grid panel - the body is not resizing correctly (so the vertical scroll bar on the grid is too tall, and the bottom arrow of the scrollbar/last row of the grid view is cut off).

My grid overrides onRender and takes my pre-existing top toolbar and adds the additional toolbar to the top toolbars's container:



onRender: function (ct, position) {
UI.Grids.DynamicGridPanel.superclass.onRender.call(this, ct, position);

if (this.bulkActionsToolbar) {
this.toolbars.push(this.bulkActionsToolbar);
var owner = this.getTopToolbar().ownerCt;
owner.add(this.bulkActionsToolbar);
this.doLayout();
}
},


The toolbar does render correctly, but as mentioned the body of the grid panel is too high, preventing the user from scrolling to the last item row in the grid (as it's cut off).

Is there any way to force the body to render at the correct height, accounting for the additional toolbar I have added to the top?

bittercoder
17 Apr 2011, 8:42 PM
Found that following the advice of jack here:

http://www.sencha.com/forum/showthread.php?11825-Ext-2.0-How-to-add-multiple-toolbars-to-a-Grid&p=57883

Led me to this simple solution (replacing my previous override of onRender)



afterRender: function () {
UI.Grids.DynamicGridPanel.superclass.afterRender.call(this);
if (this.bulkActionsToolbar) {
this.toolbars.push(this.bulkActionsToolbar);
this.bulkActionsToolbar.render(this.tbar);
}
}