Column size does not match the cursor location after resizing

Sep 10, 2010 at 1:01 PM

IE does not include the cell's left/right padding in the cell's width. For example, when you've given a cell a size of 50px but that cell has 5px for left and right padding, the actual size of the cell will be 60px (50+5+5). This affects the column resizing by not setting the column's edge where you let go of the mouse but 10px wider in the example given.

To fix this do the following:

in CoolGridView.js, function OnDocMouseUpHandler find the following line:

var width = cursor.x - $$$.Event.resizeState.minX;

and add the following right after it:

var column = $$$.Event.resizeState.eventTarget.TableColumn;
        //if the offsetwidth does not equal the width of the element then the browser is probably IE. For IE, en element's padding is outside of its set width so subtract the padding from the calculated width.
        var paddingWidth = $$$.Event.resizeState.eventTarget.offsetWidth - ((typeof column.ColObject != 'undefined' && column.ColObject != null) ? column.ColObject.width : parseInt(column.style.width,10));
        width -= paddingWidth;

 

This fix will still work for other browsers.