Search code examples
jqueryjqgridfree-jqgrid

Free jqGrid 4.8.0 - Issue with autoResize


I finally was able to upload the bug into jFiddle after days of trying to re-create it. I noticed this since I ported from 4.7.0, but couldn't pin-point the exact issue.

The jFiddle describing the issue is at jFiddle demo

This is the problem:

If you set autoResize to true, and if the number of lines in the grid are longer than the grid height (so that you start to see the overscroll on the right), with every double click you will do on the column to auto resize it, the entire grid will shrink, and it keep shrinking more and more with every additional click. (Just click on the column resize between session_status and end_time, you will see they are changing while the grid width keep shrinking all the time).

If you play with the jFiddle and will have number of lines smaller than the height, then grid works as expected, just do $('#jqGrid').jqGrid('setGridHeight', 500, false);

(Just click on the column resize between session_status and end_time, you will see they are changing while the grid width kept the same).

It was hard for me to nail down the issue on jFiddle since it was hidding only while the num of lines are higher than the grid height.

Is there any way I can work around this issue?

(p.s. this is just an example I keep re-using for demo, so didn't move it to templates yet)

Thanks,

Tal.


Solution

  • I can confirm, that it's a bug which I fixed now after your bug report. The resizing of the grid is very complex and tricky because there are a lot of different parameter combinations. I hope that new changes have no side effects.

    You should refresh the sources of free jqGrid from GitGub. The modified JSFiddle demo http://jsfiddle.net/OlegKi/mrfvsyc2/8/ uses the latest sources from GitHub and the problem is fixed now. The fix consist from replacing the line

    if (p.tblwidth < p.width) {
    

    to the following

    if (p.tblwidth + (hs ? scw: 0) < p.width) {