PDA

View Full Version : Getting rid of vertical scrollbar in GridPanel



damnos
23 Dec 2009, 8:54 AM
Is there anyway to force gridpanel to never have a vertical scrollbar?
It seems to me it always automatically render that extra empty column at the end.

Is there anyway to get rid of that extra column for scrolling? I made sure that scrolling never happens (through the table height and page size), but always still have that empty extra column.

I dont see anything in the config that can force this, I tried setAutoScroll method and pass it false, but still rendering that empty column

Thanks!

ColinBowern
23 Dec 2009, 10:03 AM
Not sure if is the right way but you could set scrollOffset to 0.

Izhaki
7 Jan 2010, 1:55 PM
The following hack will make sure that there is no blank space if there is no scroller:



var courseListGrid = new Ext.grid.GridPanel({
store: coursesHashStore,
width: 150,
columns: [
{id:'course', header: 'Course', dataIndex: 'course_id'},
],
title: 'Courses',
hideHeaders : true,
columnLines : false,
viewConfig: {
forceFit: true,
scrollOffset : 17,
onLayout: function(){
// store the original scrollOffset
if (!this.orgScrollOffset)
this.orgScrollOffset = this.scrollOffset;

var scroller = Ext.select('.x-grid3-scroller', this).elements[0];
if (scroller.clientWidth == scroller.offsetWidth)
{
// no scroller
this.scrollOffset = 0;
} else {
// there is a scroller
this.scrollOffset = this.orgScrollOffset;
}
this.fitColumns(false);
}
},
sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
});