Hide/Show columns and reading the config

I want to hide/show columns of a datatable and save the configuration.

  1. Hide/Show

Hide/Show is easy, but there is no toogle function.

  1. Reading the column width and hidden-attribut.

I can iterate over the Config of the datatable, but hidden columns are removed from the list.

table.config.columns

My Workaround: I use the column-names seperate and this workaround …

d= webix.$$("my_datatable");
for (var i = 0; i<names.length; i++) {
  hidden = false;
  if (d.getColumnIndex(names[i])==-1) { 
    d.showColum(names[i]);
    hidden = true;
  }
  width = d.config.columns[d.getColumnIndex(names[i]].width;
  if (hidden) { d.hideColumn(names[i]); }
}

Is there a better solution to get hidden/width attribute from a datatable?

  1. I think the next can be used to toggle column’s visibility
if (table.isColumnVisible("some"))
    table.hideColumn("some")
else
    table.showColumn("some")
  1. Yep, there is no way to access the configuration of hidden column. We will change this in the next build. DataTable already has getColumnConfig method, starting from the next build it will return configuration for both visible and hidden columns.

Also, to get a list of hidden columns you can use

var hidden = table.getState().hidden;

Fixed build ( v.1.5.1 ) is available at github - Releases · webix-hub/webix · GitHub