0

I want to hide a column or select different width based on the data I am getting on load event but its not working. Here is the code I tried

loadComplete : function(){
            $(this).jqGrid('setColProp', 'ID', {
                hidden: true
            });
        },

but the ID column is still being shown...

coure2011
  • 37,153
  • 75
  • 206
  • 328

1 Answers1

2

try this. Sample fiddle

loadComplete : function()
{
   //Works with new api
   $(this).jqGrid('hideCol',["ID"]); 
   //following works with Older api
   //$(this).hideCol("ID");    
}
Deshan
  • 2,102
  • 24
  • 29
  • Can you point me to documentation of this? I also want to change width, whats the method for that? – coure2011 Jan 29 '15 at 08:38
  • @coure2011: jqGrid 4.6/4.7 don't have any method which allows you to change the column width **dynamically**. *The user* can only use drag & drop of the column resizer (between the headers of two columns). I wrote `setColWidth` method (see `jQuery.jqGrid.setColWidth.js` [here](https://github.com/OlegKi/jqGrid-plugins) and [the answer](http://stackoverflow.com/a/20030652/315935)) which you can use. I'm developing now new *free* version of jqGrid [here](https://github.com/OlegKi/jqGrid). It contains the method and many other new features for resizing of columns. – Oleg Jan 29 '15 at 17:24