0

In my jqgrid, I can resize all columns.

Initially when grid is rendered, then all the columns are shrink to fit and there is no empty space at the right edge.

When I resize any column then I always get horizontal scroll (when the column width is increased) or empty space (when column width is decreased). I want to fill this space everytime. i.e. my last column should do that. If any column increased then I would subtract that pixels from last column or if any column is decreased then I would increase that pixels from last column. The result will look like that there is never a horizontal scroll or empty space.

resizeStop: function(width, index) { 
    initialWidth = this.p.colModel[3].width; //***see below note about this line***
    var finalWidth = Math.abs(initialWidth - width);
    alert(finalWidth);
}

***this gets me default width at the time of initialisation. I need initial width i.e. before resizing. So that I can do maths with it.

Fiddle - http://jsfiddle.net/aUDHx/597/

Any help greatly appreciated.

Ashwin
  • 12,081
  • 22
  • 83
  • 117

1 Answers1

0

You need call setGridWidth inside of resizeStop like I suggested in the answer. You should try the code from UPDATED part of the answer if you use one from the latest version of jqGrid. In case if the code do not exactly what you need you should describe the test case and I'll wite how you can fix the problem.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Please check this fiddle - http://jsfiddle.net/aUDHx/597/ After implementing your solution and now resizing column does not work. Actually it is reset to original position. – Ashwin Mar 07 '14 at 07:14