Hi,
thanks for your post, and sorry for the trouble.
Yes, this is possible. Please add this to the “Custom Commands” text field on the table’s “Edit” screen:
"columnDefs": [ { "visible": false, "targets": [ 6, 7, 8 ] } ]
This will hide columns 7, 8, and 9 (counting starts with 0 in this type of code), but they can be made visible again using the Column Visibility button.
Regards,
Tobias
hmmm…I tried this code and it doesn’t seem to have worked? Am I missing something obvious?
Also, now the extension styling has disappeared from the page.
Here is my shortcode that doesn’t seem to be working (and was before I tried to edit the custom commands). I have updated the plugins to the latest versions just now:
[table id=1 responsive=”scroll” datatables_buttons=”colvis,copy,csv,excel,pdf,print” datatables_fixedcolumns_left_columns=2 /]
Thanks in advance for your help,
b.
-
This reply was modified 5 years, 2 months ago by
20fudge21.
ps I’ve significantly shortened the table so that I could work with the custom Commands otherwise it was taking forever to open in wordpress (1700+ rows!)
Hi,
where exactly did you add the code? And it seems that the “Use DataTables” checkbox might not be checked anymore, on the table’s “Edit” screen?
Regards,
Tobias
Ahhh yes, sorry I must have unclicked it by mistake – doh! All the extensions have appeared but the datatable buttons are no longer white but seem to be transparent?
Re: column visibility – I put in your code in the ‘Features of the datatable javascript library’ section in the text box that’s labelled ‘custom commands’ – is that correct?
Thank you 🙂
Hi,
nice, it’s working again! Yes, you put that code in the correct place.
The changed colors are a result of the updated version that I shipped today. To restore the colors, please add this to the “Custom CSS” textarea on the “Plugin Options” screen of TablePress:
button.dt-button {
background: linear-gradient(to bottom, white 0%, #e9e9e9 100%);
}
One more thing, to rule out interference with the FixedColumns feature: Please remove the responsive="scroll" parameter from the Shortcode.
Regards,
Tobias
Awesome – it works!
Thanks so much Tobias, really appreciated!
All best,
b
Hi,
no problem, you are very welcome! 🙂 Good to hear that this helped!
Best wishes,
Tobias
P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!