2

I have a grid that I want it's width to be always 100 % of the container. I got his working by setting autowidth: true. Now the problem is that when I hide a column my grid no longer expands to 100% of parent's width.

Here is an example illustrating the issue.
De-comment the line with in the load complete to see both cases.jsfiddle

 loadComplete: function(data){
        //$(this).hideCol(['number']);
    }
zouza
  • 33
  • 10

1 Answers1

1

This is happening because you're hiding the column after the grid has finished loading, e.g. the total width has already been calculated. If you always want the 'number' column hidden then just add the hidden: true property to it.

Modified fiddle: http://jsfiddle.net/fo3wb58w/

If you want to dynamically hide columns at startup (your question doesn't make this clear) then please take a look at How to adjust the column width of jqgrid AFTER the data is loaded?

Community
  • 1
  • 1
MeterLongCat
  • 228
  • 2
  • 11