Kashorako
Kashorako

Reputation: 53

Dynamic Columns Based on User Selection (Laravel)

i have a question, what i want to achieve is something like this: I'm using Laravel in my project, but i want to let every user customize his own tables views (show or hide columns) For example, in the next image i have three columns:

[First Header]

fh

But i want to let the user pick (show or hide) the columns he wants,

[Extra Columns]

ec

How do i achieve something like that? I am using Laravel and Jquery Datatables for the tables views.

I was thinking of create a table in the database which can store the columns (in a json) for every user and each module. I'd like to know if there is a better approach.

Thanks in advance, blessings!

Upvotes: 2

Views: 1293

Answers (1)

Kashorako
Kashorako

Reputation: 53

As @Remul said in his comment, Datatable has its own functions (stateSaveCallback and stateLoadCallback) Mixing that with State saving gave me what i needed

https://datatables.net/reference/option/stateSaveCallback https://datatables.net/reference/option/stateLoadCallback

Upvotes: 1

Related Questions