• Resolved Brejen2014

    (@brejen2014)


    Hi Tobias,

    When you have a moment, could you please direct me to the CSS to affect the BUTTONS in Column Visibility? I need to make the buttons (DISABLE/ENABLE) obvious by perhaps adding color. Thank you.

    Brejen

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    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

    Thread Starter Brejen2014

    (@brejen2014)

    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.

    Plugin Author TobiasBg

    (@tobiasbg)

    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

    Thread Starter Brejen2014

    (@brejen2014)

    I already have a command in there, how do I separate this command and the other command? Semicolon? Pipe?

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    just combine them with a comma.

    Regards,
    Tobias

    Thread Starter Brejen2014

    (@brejen2014)

    These commands did not work for me
    "dom": "BWlfrtip","columnDefs": [ { "visible": false, "targets": [ 2,3,4, 5 } ]

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    ah, looks like I forgot a ]. Please try again with

    "dom": "BWlfrtip", "columnDefs": [ { "visible": false, "targets": [ 2,3,4,5 ] } ]
    

    Regards,
    Tobias

    Thread Starter Brejen2014

    (@brejen2014)

    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

    Plugin Author TobiasBg

    (@tobiasbg)

    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

    Thread Starter Brejen2014

    (@brejen2014)

    I think I figured it out! Should be colvisGroup and not colVisGroup. LOL

    Plugin Author TobiasBg

    (@tobiasbg)

    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!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘CSS for Column Visibility’ is closed to new replies.