2

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!

2
  • 5
    DataTables button extension provides a column visibility plug-in that does what you want. It stores the column visibility in LocalStorage, here is an example. Commented Jul 3, 2020 at 14:51
  • @Remul, sorry for the late answer, thank you so much. I'm using your solution and is working just fine, thanks again! Commented Jul 28, 2020 at 18:32

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.