5

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?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Svetlozar Angelov
  • 21,214
  • 6
  • 62
  • 67

1 Answers1

20

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)

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
GavinWoods
  • 813
  • 2
  • 14
  • 28
  • 1
    +1, thanks for the answer. This is what I found myself, after all I ended with so changed/custom Flexigrid.js, that I can not even use it elsewhere... :) – Svetlozar Angelov Dec 19 '09 at 07:06
  • Thanks for sharing code. I have updated code to not enable hide column from show/hide column list – Amit Thaper Jan 15 '13 at 06:33