• Resolved ryansebiz

    (@ryansebiz)


    I cannot get the alternate row highlighting to work. I’m using a custom theme I created from a blank theme (with its .odd & .even rules removed). The plugin’s “Alternating row colors” checkbox is checked and is not working. Switching to the default Twenty Ten theme didn’t solve the problem. Next I tried editing the custom css in the plugin options (which also didn’t work):

    .wp-table-reloaded-id-1 .odd td {
    background-color:#e5e5e5 !important;
    }

    What is weird is that when I look at view source I see the tr even and odd classes. However, when I inspect the table in Firebug or Chrome these classes don’t appear – it just says tr class=”row 1″, tr class=”row 2″, tr class=”row 3″, etc.

    The only solution I can think of is to manually write out all of the CSS rules, but one of my tables is 400 rows:

    table.highlight .row-3 td,
    table.highlight .row-5 td,
    table.highlight .row-7 td,
    table.highlight .row-9 td,

    table.highlight .row-401 td {
    background-color:#e5e5e5 !important;
    }

    Surely there’s a simpler solution. The site is located here:

    http://bit.ly/iks99g

    Herzlichen Dank!

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

    (@tobiasbg)

    Hi Ryan,

    thanks a lot for your comment.

    This is really weird, I can confirm your observations, but can’t find a real reason…
    My feeling is that the DataTables JavaScript library is for some reason stopped in midst of its initialization process: The library usally removes the even/odd class from the HTML and “refreshes” them with its own (which actually are the same). So, between the removing and the re-inserting, something happens.
    This is kind of confirmed by the fact that the sorting is also not working and that the “Search” field is not appearing.

    Can you temporarily turn of the usage of the DataTables library to confirm this?

    Regards,
    Tobias

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi again,

    just found the probable reason:

    It is indeed the DataTables library, but its not directly its fault.
    DataTables is trying to load a language file from https://www.stanford.edu/dept/athletics/cgi-bin/champions/wp-content/plugins/wp-table-reloaded/languages/datatables/lang-en_US.txt
    Your site however is located at the server https://champions.stanford.edu/. Thus, the AJAX call to get the file would be a cross-domain call, which is not allowed. AJAX calls can only go to the same domain.
    You can see that this fails nicely on the Network tab in the Chrome Developer Tools, there’s never an answer to the request.
    Amd due that, DataTables breaks and never finishes its initialization.

    The correct location to grab that file from would be https://champions.stanford.edu/wp-content/plugins/wp-table-reloaded/languages/datatables/lang-en_US.txt.

    As the wrong path (https://www.stanford.edu/dept/athletics/cgi-bin/champions/…) is used for loading your theme and other files as well, I suspect this to be bad configuration on your server. This is however probably a multisite install, which you have no config rights for, right?

    If possible, I suggest that you try to fix those URLs (I believe you would need to play with the WordPress SiteUrl and WordPress BaseUrl settings). If that is not possible, due to the multisite install, I’ll show you a fix for the DataTables problem (by simply filtering the URL), but the best way really would be to fix those URLs.

    Regards,
    Tobias

    Thread Starter ryansebiz

    (@ryansebiz)

    Hi Tobias,

    Thanks so much for the quick reply and troubleshooting! Yes, I’m pretty much unable to change the URL. The IT guys setup a reverse proxy and I can’t change the short URL to the full one or it will break the site.

    If you could show me the URL filtering fix for the DataTables problem that would be awesome!

    Danke schon!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi Ryan,

    yeah, that makes sense then, also it’s not the nicest solution, unfortunately – so you might keep this problem in find in case of trouble with plugins in the future.

    To fix the loading of the language file for DataTables, please add the following code to your theme’s “functions.php”:

    function adjust_wp_table_reloaded_url_datatables_language_file( $url ) {
      return 'https://champions.stanford.edu/wp-content/plugins/wp-table-reloaded/languages/datatables/lang-en_US.txt';
    }
    add_filter( 'wp_table_reloaded_url_datatables_language_file', 'adjust_wp_table_reloaded_url_datatables_language_file' );

    Best wishes,
    Tobias

    Thread Starter ryansebiz

    (@ryansebiz)

    Tobias,

    Wow – you’re a genius! That solved the problem! Thank you!

    That’s a great solution I’ll keep in mind for other plugins in the future.

    I also really appreciate your plugin – one of the best for WordPress.

    Vielen Dank!

    P.S. I just made a PayPal donation 🙂

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi Ryan,

    thanks for the confirmation that this works! 🙂

    And thank you very much for your nice words and the donation, I really appreciate that!

    Best wishes,
    Tobias

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: WP-Table Reloaded] Alternate row highlighting not working’ is closed to new replies.