Forums

[Plugin: WP-Table Reloaded] Checkbox Filter + Formatting Options (2 posts)

  1. calbear81
    Member
    Posted 1 year ago #

    I'm using WP Table Reloaded to handle creating a restaurant menu to display on the page. Some of the items are marked as "Spicy" or "Vegetarian" and I wanted to include two buttons on top to filter against items that have that characteristic. For now, I've created two columns and put an "x" if it matches. What I want to do is have those cells display a custom css background if there is an "x" to show an icon that represents "spicy" or "vegetarian". If there is no "x", it just stays blank. Am I correct in assuming this will require scripting to check if the table cell has a value and then I can use a custom call to return only items that have that field populated?

    Next, in some cases, I have multiple menus such as Breakfast, Lunch, Dinner and I don't want to create multiple tables for each. From the documentation, it sounds like if I do a colspan, then the instant search filtering and javascript options will break. Is there any hack/way to allow me to add section headers to the table while preserving the javascript functionality?

  2. TobiasBg
    Member
    Posted 1 year ago #

    Hi,

    sorry for the late answer. Unfortunately, your question was tagged incorrectly, so I didn't see it until now.

    Basically, you are correct with your assumptions. If you want to add that styling automatically, you will need some sort of scripting.
    Unfortunately, I don't have any code or examples for this, so I can't help with this at all :-(

    For the second question. Yes, unfortunately, colspans will likely break the search and other JavaScript features. (This is however a limitation of the DataTables JavaScript library, so there's nothing that I can do in WP-Table Reloaded about it.)
    Unfortunately, I don't see any other chance. Either use separate tables or one table without the JavaScript (you might actually want to try that first, because the problem does not always happen, from what I have seen).

    Best wishes,
    Tobias

Topic Closed

This topic has been closed to new replies.

About this Topic