institut-de-genomique / Ultimate-DataTable

This AngularJS directive generate a HTML table with build-in fonctionnality like save, edit, remove, pagination etc...
http://institut-de-genomique.github.io/Ultimate-DataTable/
45 stars 26 forks source link

Column hidden by default #12

Closed Jenselme closed 8 years ago

Jenselme commented 8 years ago

Hi,

I just started to use Ultimate DataTable. It's awesome, thanks!

However, I searched for a way to make a column hidden by default in the configuration but I didn't find any solution. I would also like to hide/show a column programmatically.

Is it possible? If not, would it be possible to add it? I should be able to contribute if necessary.

galbini commented 8 years ago

Hello,

Effectively, there are no possibility to hide a column by default.

You can program this comportment. First extract all columns after datatable configuration and then set column must be hide. see below

$scope.datatable = datatable(datatableConfig);
$scope.datatable.setData(datatableData);
//extract all column
var columns = $scope.datatable.getColumnsConfig();
//hide the first column.
$scope.datatable.setHideColumn(columns[0]);

Thanks to use UDT ! Guillaume

Jenselme commented 8 years ago

It's a good new that I can programmatically hide a column, I will need it. But it will be easier for me to have an option to make it hidden by default. Should I work on a patch to add this behavior?

galbini commented 8 years ago

Yes, I try to find a solution

galbini commented 8 years ago

Hello,

I add a param byDefault on hide configuration to hide default columns. You need to put the column.property value in byDefault parameter.

"hide":{
    "active":true,
    "byDefault":["about","name"]
}

Guillaume

Jenselme commented 8 years ago

Awesome, thanks!