Okay
  Public Ticket #2254233
CSS code apply to only one table
Closed

Comments

  •  1
    Jon Falcone started the conversation

    Is there a way to apply CSS code in the box labeled 'Custom wpDataTables CSS' to only apply to specific table(s). Or whatever code you put in that box applies to every wpDataTable you have?


    For example if I use .wpDataTable it applies to all my wpDataTables. Is there a way to apply to only one table for example wpdatatable_id=54 ?

    I am very desperate to to freeze specific headers and columns in different tables.

    Thanks!

  •  2,572
    Aleksandar replied

    Hello Jon

    When you add some CSS to that field, it applies to all tables - front-end and back-end.

    However, if you wish to add it to a specific table on front-end, you need to include it on the page between the <style>...</style> tags, above the shortcode, in HTML editor like this:

    <style>
    table.wpDataTable .customCss {
    display: none !important;
    }
    </style>
    [wpdatatable id=2]

    That will apply the custom CSS only to the table(s) that appear on that page.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •   Jon Falcone replied privately
  •   Aleksandar replied privately
  •  1
    Jon Falcone replied

    Thanks for the response Aleksander. What I bolded in the below code is not working (I've tried it with other tables and it works meaning it freezes the header of the table and the 2nd column of the table). Do you know what I should replace that with to work with wpDataTables?


    Thanks so much!


    <style>
       tbody tr td:nth-child(2){
        position: sticky;
        position: -webkit-sticky;
        left: 0;
        z-index: 1;
        background: #fafafb;
        font-weight:bold;
    }
     .foo-table{
        max-width: -webkit-fit-content !important;
    }

    {
        position: relative;
        z-index: 1;
        margin: auto;
        overflow: auto;
        height: 550px;
    }

     thead .footable-header th {
        position: -webkit-sticky;
        position: sticky;
        top: 0;
        z-index:1;
    }

     thead th:nth-child(2){
        position: sticky;
        position: -webkit-sticky;
        left: 0;
        z-index:2

    }
    </style>
    [wpdatatable id=54 table_view=regular]

  •  2,572
    Aleksandar replied

    Hi again Jon.

    I'm not sure, to be honest.

    Please provide me a temporary WP-admin login for your site where this happens, so we could log in and take a look ‘from the inside’ as that’s the most efficient way to see and resolve the issue. We do not interfere with any data or anything else except for the plugin (in case that’s a production version of the site), and of course we do not provide login data to third party. You can write credentials here just check Private Reply so nobody can see them except us.

    Also, please tell me where that CSS is located, and to which table it applies. If you have the table in front-end, also share the URL of it with me.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •   Jon Falcone replied privately
  •   Jon Falcone replied privately
  •   Jon Falcone replied privately
  •   Aleksandar replied privately