• I am not sure if these two questions are directly related, but I suppose they are so I will ask them both in this thread.

    I am building a website to track the results of some horse shows. Each show has multiple “classes”, and several of those classes the results are broken down into divisions. The people who run the show enter all the data into an Excel spreadsheet. Their old way of doing the website was to use Excel to “generate” the html, including the little tabs for worksheets at the bottom. We’re loving the wp-table-reloaded plugin so far and it seems to be working great for our purposes!

    I have entered one show’s results on the following page: https://72.52.241.3/~nbhatx30/?p=172 (this is a development link). So far I’m getting around the “tabs” issue by generating each “worksheet” from Excel as its own table, and then using some css/js to hide those tables and then return the corresponding div (containing that particular table’s shortcode) upon clicking the link at the top.

    The main problem, however, lies in the sorting part. If you click to sort, say, the “Name” (Rider’s name) column, it sorts them correctly according to being alphabetical, which puts the “1D, 2D” etc. at the top. We need some way to exclude those rows from the sort. I think I read that this is possible somewhere but I’m still searching for it.

    Now, to take that concept one step further, is how the results of each “D” (division) are displayed. Using the first table displayed (the “Open 4D Poles” table) as an example, you can see how there are 4 divisions, with the first, second, and fourth actually having results. In this show’s case, there were no results for the 3rd Division (but there usually are). Is there any way to possibly sort the fields using the sort headers columns but keeping the “divisions” in tact? So if you sort by TIME, instead of seeing the 1D,2D,3D,etc headers lumped at the top, and then ALL times listed in numerical order, is there any way to divide them out based on the divisions they are in? If this isn’t possible, that’s fine, I’d like to stick to the sorting method in my first question – just removing some of those headers.

    Oops I forgot to say, here is a screen shot of the Open 4D Poles Excel spreadsheet – https://screencast.com/t/YmY0MWNi … If I need to change my “export method” to something else (for example, remove headers or something?) I’m certainly able to do that – I would just need to know how as I’m not very familiar with Excel, and I can’t request the show people to change how they enter it.

    Thanks again!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi lilqhgal,

    thanks for your questions!

    Indeed they are related to each other, in fact they pretty much mean the same (if I understand them correctly) ??

    Regarding that first thing, the worksheets in Excel.
    I think you found a nice solution with those divs that show a table when clicked upon. That’s pretty much the way to go, as I can’t think of a better way of displaying those worksheets/tabs.

    Now the sorting:
    You are pretty much looking for this, it sounds to me:
    https://datatables.net/examples/advanced_init/row_grouping.html
    (Select 100 from the “Show entries” dropdown to see it in its full beauty.)
    On that page, the gray rows basically resemble the divisions. And the sorting does only sort within those divisions (something that is in a division will thus never leave it).

    As you can see from the “Initialisation code” below the table, there’s some coding involved, but it’s actually easily possible to add that to the basic code that’s triggering the sorting in WP-Table Reloaded (using a “WP-Table Reloaded Extension” that filters the “wp_table_reloaded_js_frontend_command” hook).
    Additionally, some CSS might be required (for the coloring and stuff). Moreover, you will need an additional column in your table. That’s where the name of the group/division is taken from, and that column is actually hidden to the visitor of the page. (On that example page, when viewing the source, you’ll see that every row has the group to which it belongs in the first column.)
    So, your table’s rows would need one of “1D”, “2D”, “3D”, “4D” in the first column, so that the script knows what group they are.
    In turn, you might then no longer need the actual rows for “1D” etc. (which you colored blue) as they are automatically generated.

    So that’s it ??

    Coming back to Excel:
    Your export method is fine (assuming that you export each of the tabs/worksheets to a separate CSV file which you then import into WP-Table Reloaded) and needs no change. Also, you should not change the actual Excel layout, as your show people have by now accustomed to it, I guess.
    There’s just some extra work to be done by you after importing the CSV files:
    – Main thing that I noticed is the first row of the table. That’s set to the name of the race, like “Open 4D Poles”, although that information is already printed above the tables (where the visitors clicks on). Bad thing about this method is that your real table headers (the words that actually describe what the columns mean) are stored as regular rows. So, after every import, just delete the first row of the tables, so that “# Name M Horse’s Name Time $ Points” is the actual first row of the table.
    – Additionally you will need to create and fill that mentioned new first column (with the name of the division in it).

    I hope all this information is helpful ??

    Best wishes,
    Tobias

    Thread Starter lilqhgal

    (@lilqhgal)

    Thank you for the WONDERFUL (and fast!) response!

    Ok so just to make sure I’m on the right track, I should follow your blog post on creating a wp-table-reloaded-extensions PLUGIN file and add that “initialization” code to the plugin file? (Please forgive the noob questions – I’m a frontend designer, definately not a backend developer LOL).

    Hi,

    you’re welcome for the response ??

    You are absolutely correct about the Extension plugin file.
    However it is not enough to just paste the “initialisation code” there, as that code is JavaScript code, but the extension plugin is PHP.

    I don’t have this code ready yet, but I’ll fix it up this evening, once I get home from work.
    As you have kindly donated, I’m more than willing to share it with you and assist in getting it to work with your table, of course.
    For this, it would be great, if you could contact me by email (can be found in the main plugin file or in the Imprint on my website), so that I can eventually email you the code.

    Best wishes,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: WP-Table Reloaded] Hiding certain rows from sort, and displaying “subsections”?’ is closed to new replies.