getColumns

returns an array of columns

array getColumns( [boolean all] );
allbooleandefines whether to include the hidden columns
arrayan array of column objects

Example

// hide the title column
$$("grid").hideColumn("title");
// get all the columns including the hidden "title" column
var allColumns = $$("grid").getColumns(true);

Related samples

Details

By default the method returns a copy of all visible columns. If you need to include hidden columns as well, pass true as a parameter.

The method can be used to manipulate the Datatable with hidden columns:

// get a copy of all the columns
var columns = $$("grid").getColumns(true);
 
// add new column 
columns.splice(columns.length-1, 0, {
  id: "col_"+count,
  header:"Column "+count, 
  hidden:true
});
 
// repaint the table with modified data
$$("grid").refreshColumns(columns);
See also
Back to top