views:

443

answers:

4

I have been working with the jQuery Grid the past few days and one thing I have not found any documentation on yet is the ability to hide a column by default.

The reason I want this is that I'm building my JSON w/ every property of my object yet my grid might only show 75% of these as valid columns. I want the ability to pass back more JSON than I actually use, and one way I thought to accomplish this would be to hide the columns I'm not using.

Any other suggestions are welcome, but I would prefer the ability to push down a larger list of JSON than I actually use by default.

+4  A: 

In the colModel initializer array, you can specify

hidden: true

on any of the columns.

great_llama
A: 

What if you need to edit that hidden column? How do you show the column in edit mode?

A: 

What version of flexgrid are you using...? my one doesn't accept hidden property in colModel

it does accept

hide: true
qba
A: 

Can someone answer yafuka's question? As i have been searching for a solution to this for a while now and found no solutions.

The only way i got it to work was to use the edit dialog box & jquery as follows:

    gridComplete: function(){
                        //id of grid table:  #grid_pages 
                        // 'hide_column' is the nth column which should be hidden
                        var hide_column = 2;
                        $('#grid_pages td:nth-child('+hide_column+')').hide();
                        $('#grid_pages').parent('div').parent().siblings('.ui-jqgrid-hdiv').find('th:nth-child('+hide_column+')').hide();
                        }

This will hide the columns for 'display' but will still show it in the 'edit dialog'