Hi,
thanks for your post, and sorry for the trouble.
The relevant CSS code is in the CSS file
/wp-content/plugins/tablepress-datatables-buttons/css/buttons.dataTables.css
of the Extension, especially in the parts that deal with the “dt-button-collection” from what I can see.
To modify this, I recommend playing around with the Developer Tools in your browser (I recommend Chrome for this). There, you will see the exact CSS selectors and can play around with live changes. Then, add the relevant CSS to the “Custom CSS” in TablePress (instead of directly editing the CSS file).
Regards,
Tobias
Thanks.
Anyway I can set my default fields that are enable and disabled? Right now all fields are enabled. Not sure if there’s an option to limit the visible fields on load.
Thanks again for your assistance.
Hi,
I’m not exactly sure, but I think the general way of hiding a column using the DataTables “Custom Commands” should work here.
Please try adding this to the “Custom Commands” textfield on the table’s “Edit” screen to try it
"columnDefs": [ { "visible": false, "targets": [ 2, 5 } ]
This should hide columns 3 and 6 and highlight/mark that in the Visibility dropdown as well.
Regards,
Tobias
I already have a command in there, how do I separate this command and the other command? Semicolon? Pipe?
Hi,
just combine them with a comma.
Regards,
Tobias
These commands did not work for me
"dom": "BWlfrtip","columnDefs": [ { "visible": false, "targets": [ 2,3,4, 5 } ]
Hi,
ah, looks like I forgot a ]. Please try again with
"dom": "BWlfrtip", "columnDefs": [ { "visible": false, "targets": [ 2,3,4,5 ] } ]
Regards,
Tobias
That worked! Can I please get your expertise on another issue?? One last request about custom commands, what’s wrong with this?? I couldn’t get it to work.
"dom": "Bfrtip", "buttons": [ { "extend": "colVisGroup", "text": "Phone Contacts", "show": [0,3,5], "hide": [1,2,4,6,7,8,9,10] }, { "extend": "colvisGroup", "text": "Show All", "show": ":hidden" } ]
I followed this from the website:
https://datatables.net/extensions/buttons/examples/column_visibility/columnGroups.html
Hi,
I’m not an expert with these commands, unfortunately, but I can try to take a look. Can you please post a link to the page with the table where this problem happens? Thanks!
Regards,
Tobias
I think I figured it out! Should be colvisGroup and not colVisGroup. LOL
Hi,
ah, indeed. Nice spot! Those small typos can really cause headaches…
Best wishes,
Tobias
P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!