Ok if anyone else runs into this, I did fix it. Fix submitted in the bug reports column. If anyone else runs into this, here's briefly the fix.
The bug seems to be triggered by force fitting columns, which calculates column widths by dividing the total grid width by the number of columns and making some adjustments. Unfortunately this calculation results in fractional numbers quite often, leading ext to round and discard those fractions of pixels, which causes the total width of columns to be less than that of the entire grid, giving you a gap.
Here's a custom grid subclass that fixes this. I subclasses grid panel to call the grid view subclass, so I don't have to go around and manually create a grid view everywhere. If you want you can just use the grid view subclass and assign it to all of your grids.
Code:
Ext.ux = {};
Ext.ux.FullGridPanel = Ext.extend(Ext.grid.GridPanel, {
getView : function() {
if(!this.view) {
this.view = new Ext.ux.FullGridView(this.viewConfig);
}
return this.view;
}
});
Ext.ux.FullGridView = Ext.extend(Ext.grid.GridView, {
/* this probably doesn't need to redo the whole method, however I'm being lazy */
// private
fitColumns : function(preventRefresh, onlyExpand, omitColumn){
var cm = this.cm, leftOver, dist, i;
var tw = cm.getTotalWidth(false);
var aw = this.grid.getGridEl().getWidth(true)-this.scrollOffset;
if(aw < 20){ // not initialized, so don't screw up the default widths
return;
}
var extra = aw - tw;
if(extra === 0){
return false;
}
var vc = cm.getColumnCount(true);
var ac = vc-(typeof omitColumn == 'number' ? 1 : 0);
if(ac === 0){
ac = 1;
omitColumn = undefined;
}
var colCount = cm.getColumnCount();
var cols = [];
var extraCol = 0;
var width = 0;
var w;
for (i = 0; i < colCount; i++){
if(!cm.isHidden(i) && !cm.isFixed(i) && i !== omitColumn){
w = cm.getColumnWidth(i);
cols.push(i);
extraCol = i;
cols.push(w);
width += w;
}
}
var frac = (aw - cm.getTotalWidth())/width;
while (cols.length){
w = cols.pop();
i = cols.pop();
cm.setColumnWidth(i, Math.max(this.grid.minColumnWidth, Math.floor(w + w*frac)), true);
}
/* changed line: in ext this only adjusts if the column widths are larger than the total grid, let's do it if it's less than the total width too in order to avoid the gap */
if((tw = cm.getTotalWidth(false)) != aw){
var adjustCol = ac != vc ? omitColumn : extraCol;
cm.setColumnWidth(adjustCol, Math.max(1,
cm.getColumnWidth(adjustCol)- (tw-aw)), true);
}
if(preventRefresh !== true){
this.updateAllColumnWidths();
}
return true;
}
});