-
Notifications
You must be signed in to change notification settings - Fork 911
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
Add hidden columns and change export function to suit CRUD architecture #960
Conversation
I think this looks really good and is a really simple and nice approach. @tabacitu think this will make it into master ? Not really a hard to review PR.. :) |
Thanks @niladam, one thing i did notice this arvo is the column filter button is rendered pretty useless. Ill have a look at it tomorrow, but it may be worth just ditching it as part of this PR? What do you guys think? |
Yeah, but the column filter should stay there. Personally i think providing people with the option to CHOOSE what they want to see is a really strong point in datatables. I think it makes sense to use a different approach, and not use hidden for the |
Updated it now to just use styles to hide hidden cols. Column filter works and 'Actions' are not included in export. |
Did you test it with ajax tables as well? |
Just a note this won't work with the ajax code, also having a type hidden doesn't allow you to use the different column types for extracting the data. The way I implemented it was to set a hidden = true attribute on the column, then in the data tables code I get the array index of all columns that are set hidden = true, and define
This then hides the columns, allowing the visibility options on data tables to work for export. |
Totally agree with both @b8ne and @Spodnet here:
I’m glad to say I’ve just finished this PR #1703 , which fixes all of the above :-) So I’m going to close this PR - thank you for submitting it though @b8ne - it helped developing a more general solution. The syntax is a little changed, but you’ll notice it’s all there :-) Cheers! |
This issue still may be up for discussion.
What ive done here is made the export functionality suit the Backpack CRUD architecture rather than its native Datatables architecture.
The export will now look for columns with a given class rather than those that are visible.
The CRUD setup would be:
I have also added a
hidden
column template, so columns may be included in the export but not visible in the listing.