Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery's Flexigrid show/hide columns feature in the header

Here is my Flexigrid:

$("#grUser").flexigrid({
    url: 'someJSON.php'
    , dataType: 'json'
    , colModel : 
    [
        {display: '', name : 'Index', width :100, align: 'left'}
        , {display: '', name : 'Value', width : 100, align: 'left'}
    ]
    , title: 'Details'
    , width: 350
    , height: 200
    , singleSelect: true 
});

The show/hide columns feature in the header is really cool option, but I want to specify on which column to be available, and I am having trouble finding a good documentation about what are my options in specifying the colModel. Here

{display: '', name : 'Index', width :100, align: 'left'}

What else can we put in the definition of a column?

Additionally - what is your documentation source for Flexigrid?

like image 459
Svetlozar Angelov Avatar asked Oct 09 '09 06:10

Svetlozar Angelov


1 Answers

Unfortunately, documentation for this isn't there and is thus very frustrating. You have to look at the source code and see what you can do.

Just add 'hide: true' as shown below. Setting hide to true, will hide a column.

{display: 'Row ID', name : 'id', width : 100, sortable : true, align: 'left', hide: true}

You can set the following attributes: - display (this is what is used for column headings)

  • name (this is the database field name used for Ajax calls)

  • width

  • height

  • sortable: true/false

  • align: left/center/right

  • hide: true/false

  • searchable: true/false (only applicable if you have the search bar turned on)

like image 152
GavinWoods Avatar answered Oct 02 '22 12:10

GavinWoods