mleibman / SlickGrid

A lightning fast JavaScript grid/spreadsheet
http://wiki.github.com/mleibman/SlickGrid
MIT License
6.82k stars 1.98k forks source link

fix unnecessary horizontal scroll when the table has sub pixel width #1051

Open a-poptsov opened 9 years ago

6pac commented 9 years ago

sorry, could you leave a very short summary of how to reproduce the problem ?

a-poptsov commented 9 years ago

Sure. The environment is: windows 7, google chrome 40

We are using bootstrap3:

<div class="row">
     <div class="col-lg-10 col-lg-offset-1">
        //slickgrid
     </div>
</div>

And sometimes (depends on screen resolution and browser width) the availWidth variable has value, that is not natural number (1426.6666... for example). In this case the sum of columns width can be (depends on number of columns) bigger then availWidth after running of autosizeColumns function. In this case we get horizontal scroll that is not expected. From "point of view of source" we have this bug when for each column Math.min(Math.floor(growProportion * c.width) - c.width, (c.maxWidth - c.width) || 1000000) equals 0. In this case width of every column will be increased by 1.

After my fix column width will not be increased if total width is bigger then availWidth

6pac commented 9 years ago

thanks!

6pac commented 9 years ago

This has been integrated into my 'alternative master'. Any testing is appreciated. See https://github.com/mleibman/SlickGrid/issues/1055