Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Setting column visibility by default #1529

Closed
OwenMelbz opened this issue Jul 10, 2018 · 7 comments
Closed

[Question] Setting column visibility by default #1529

OwenMelbz opened this issue Jul 10, 2018 · 7 comments

Comments

@OwenMelbz
Copy link
Contributor

Is it possible to be able to hide a datatables column by default?

e.g

$this->crud->addColumn([
    'name' => 'phone',
    'hidden' => true,
]);

So then the column is still loaded in, but it is hidden - then you can use the column visibility to show it if needed?

@tabacitu
Copy link
Member

Not that I know of, no...

Would be nice, but I bet it'll be difficult like hell, because of datatables-responsive and datatable-colvis incompatibility...

@OwenMelbz
Copy link
Contributor Author

Well I believe you know my stance on the data tables responsive front :D

I'm sure we can come up with a solution for those who do not want to poison their eyes with collapsed tables :D

@AbbyJanke
Copy link
Contributor

My suggestion as talking on gitter :P with the new release of disabling responsive tables we can add in colvis if responsive tables are disabled. 2 for 1 special?

@tabacitu
Copy link
Member

@OwenMelbz I know, I know :-)

But I personally think the collapsible columns + "..." buttons combo is great. So far the end-users I've questioned are impressed. Well not impressed, but, you know... they thought "oh but isn't that how it's supposed to work?". I think that's as close to a compliment as it gets :-)

@tabacitu
Copy link
Member

@OwenMelbz I tried this once, but never got it to work: https://datatables.net/extensions/buttons/examples/column_visibility/columns.html

@tabacitu
Copy link
Member

Just finished the PR for this here #1703 - I think it adds a lot of flexibility, having different:

  • visibleInTable
  • visibleInExport
  • visibleInModal
    options for each column.

I can confirm you can just toggle visibleInTable to false for a column, and then it won't show up in the table, BUT it will still be searchable. So - 2 birds with one stone :-)

@potocky
Copy link

potocky commented Apr 29, 2019

Great! thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants