Support » Plugin: TablePress » Add Ability to Add Column/Row/Cell Classes

  • Resolved jonahcoyote

    (@jonahcoyote)


    Hey there,

    Thanks as always for the awesome plugin!

    Not sure if this has ever been suggested or thought or or how difficult it would be to add, but having the ability to add custom classes on a more granular level would be super helpful for those of us with really complex tables and complex styling needs.

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

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    Yes, I remember that someone asked for this before, but at this time I don’t see a convincing demand – and no clear way to easily implement this with a nice user interface.

    For cell CSS classes, I recommend using an extra HTML tag with a class in the cells, like a

    <span class="my-class">...</span>
    

    Another option could be to use the TablePress Row Highlight Extension, see https://wordpress.org/support/topic/highlight-a-row-based-on-value-question/

    Finally, you could maybe look at the available plugin filter hooks for row and cell CSS classes.

    Regards,
    Tobias

    Hi Tobias,

    Thanks for your reply. Makes sense, I’ll try and figure something else out πŸ™‚

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no problem! I hope that you can find with a good solution!

    Best wishes,
    Tobias

    Hi there,

    I agree, the ability to customize specific rows would be useful, to create sub heading in a table for instance.
    For this purpose, maybe the ability to choose <th> instead of <td> could be more simple to manage than custom classes (from a dev point of view ?)

    I tried the extension highlight-a-row-based-on-value, works fine but is a bit tricky to use with a single CSS class given it’s based on the cell content.
    I finally added a specific keyword in a row’s cell to highlight, and hid it, it does the job:
    <span style="display: none;">myprefixhead</span>

    By the way, i can’t find the “highlight-a-row-based-on-value” extension on TablePress site, neither the documentation with these handy information:

    row_highlight_full_cell_match=false to look for a part of the cell’s content
    || to look for multiple chains

    Is it discontinued?

    Best regards
    Emmanuel Soyer

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    unfortunately, using <th> instead of <td> in the middle of a table will also not work, as that’s kind of against the HTML standard, and also bad in terms of accessibility.

    The method with the Extension that you are using is the best here. Instead of adding the highlight term with an extra HTML tag, you could however just add it to a new column that you hide (with some easier CSS for example).

    And no worries, the Extension is not discontinued. I just never got around to adding it to the TablePress website, as I’m not sure where the road will go with it, in terms of extra features, etc. πŸ™‚

    Regards,
    Tobias

    Hi,

    Thanks for your answer (and great plugin).

    I think <th> in <tbody> might be HTML 5 valid, as we can see in these examples or different discussions on the web:
    https://www.w3.org/TR/html5/tabular-data.html#examples
    Might be a problem with accessibility indeed, i didn’t thought of it…

    Ah, your hidden column trick is even simpler than my method above as it uses the existing TablePress “Hide” feature, no need for inline CSS.
    Thanks for the hint!

    Good to know you still support the highlight extension.
    I understand now why it’s a bit confidential πŸ˜‰

    Best regards
    Emmanuel

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi Emmanuel,

    thanks for your feedback on this! Yes, the Hide feature actually works as well πŸ™‚

    Best wishes,
    Tobias

    Humm, i spoke too soon, just checked: TablePress “hide” feature removes the column from the frontend page markup, so not sure the hidden column content can be used with the highlight extension πŸ˜‰
    Anyway, i could also hide the column with CSS as you suggested.

    [UPDT] It doesn’t work with TP “hide” feature”: i guess the keyword can’t be found and the targeted row is finally not highlighted.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    yes, you are correct. The hiding happens before the filtering. The CSS to hide the column is then the best, I think πŸ™‚

    Regards,
    Tobias

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.