-
-
Notifications
You must be signed in to change notification settings - Fork 87
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
Responsive makes columns invisible for export even when vertically uncollapsed #90
Comments
As you say it is due to the |
For anyone interested, here's the hack I came up with: buttons: [
{
name: 'print',
extend: 'print',
exportOptions: {
rows: ...
columns: ...
},
action: function(e, dt, button, config) {
responsiveToggle(dt);
$.fn.DataTable.ext.buttons.print.action(e, dt, button, config);
responsiveToggle(dt);
}
},
...
] Unfortunately, the API has no built in toggle for Responsive, so I went with: responsiveToggle(dt) {
$(dt.table().header()).find('th').toggleClass('all');
dt.responsive.rebuild();
dt.responsive.recalc();
} Of course If you already use Combined with what I wrote earlier, this lets the user fully control columns visibility for exporting and blocks Responsive from interfering, while keeping the UI intact. Would love to see something implemented along these lines instead of relying on this hack. |
I finally figure out where to put the code function datatables.js
Hope that won't break anything |
This is working fine i have tested. But only for print option other export methods are not selecting that columns which are not visible in responsive mode. define this function above data table codes mentioned by @lenamtl
and add this to your buttons: block
|
Hi, I'm trying to update from Datatables 1.10.11 but this fix is no longuer working and is very important so the user need to export all the column not only the visible ones. |
Can you link to a test case showing the issue please? My note above says that it is working as expected in the original case described. So I'd need a test case showing the issue to be able to debug it. |
Go to https://jsfiddle.net/lenamtl/o8se63fw/ The fix provided #90 (comment) But unfortunately the fix no longuer work with newest Datatables version. |
That seems correct to me since you have explicitly told it to only export visible columns:
|
Hi, No this is not ok as the toggle items should be exported (if they are visible when not toggle), and we don't want to export hidden items. Why this old fix is no longuer working with the new version? this was added to datatables main script page completely at the beginning of the js file
and this added to buttons: block
This is a big issue and prevent me to update... |
Any news on this problem |
Sorry - I forgot to look into this at the time. Can you give me a link to a page showing the issue please? It seems to me that the selector used is selecting visible columns that are not marked as not-export-col`. I think I'll need a test case to fully understand this. |
Go to https://jsfiddle.net/lenamtl/o8se63fw/ Toggled columns are visible they are just toggled. The fix provided #90 But unfortunately the fix no longuer working with newest Datatables version. |
You just have to update
This has been working for me and I am using datatables ver: 1.10.23 I have updated the fiddle for excel export and it seems to be exporting the childrows created using responsive into excel. |
Hi, Thanks @zant123 This is working fine, I'm very happy now I will be able to update to the newest version So we just need replacing this
with this
The part that change is call(this, e, dt, button, config); |
@zant123 Many thanks for noting that ! The |
I think things are working okay here with the latest versions, so closing issue. |
Hey,
I guess this is kind of overlapping with
Buttons
, I wasn't so sure where to post this.I am using
exportOptions.columns: ':visible:not(.control):not(.select-checkbox)'
on all my export buttons (as mentioned in DataTables/Buttons#102), but unfortunately whenResponsive
collapses columns they become invisible, even though the user still has them as visible through the use ofcolvis
, obviously resulting in them being excluded from the export.On second thought, I figured this might make sense, because there's a
display: $.fn.dataTable.Responsive.display.childRowImmediate
option that collapses the columns horizontally, but keeps them uncollapsed vertically. Unfortunately, it appears as though the result is the same - Even though the data is now visible on the screen, it is still being excluded from the export due to the:visible...
selector.Is this intended behaviour? Is there a technical barrier to change this? Any chance for a fix/enhancement?
The ultimate goal is to let users easily export the columns they want through the use of
colvis
and the export buttons, and enjoy the same flexibility on smaller screens, withoutResponsive
interfering and forcing exclusion of columns due to screen size.Thanks.
The text was updated successfully, but these errors were encountered: