• Resolved jb01

    (@jb01)


    I’ve got a large dataset that I’d like to display in div tags rather than table/tr/td so I can better format them using CSS (as “cards” rather than a table).

    I’ve dug through all the doco for Tablepress but can’t find any answers. Any suggestions?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    I see what you mean, but unfortunately, there’s no existing solution for this that I know of. Your best chance is to write a custom rendering class that outputs the data as <div> instead of an HTML table. You could also try using the plugin filter hooks to use other HTML tags.

    Regards,
    Tobias

    Thread Starter jb01

    (@jb01)

    Thanks for getting back to me so quickly Tobias. I will take your advice and built a custom plugin based on one of the existing ones and use the “tablepress_table_output” hook to create a find/replace of the table tags.

    If I can make a feature request for the next major version – adding in a “template” option that can be passed within the shortcode. Perhaps that template file could be an external one (such as “mytemplate.html” or “mytemplate.xml”) and that contains tokens/tags to represent the key info that is outputted.

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    the tablepress_table_output would work, yes.

    As for that idea with templates: I don’t really see a good way for this, right now. The demand is very low, and this would need a lot of investigation first.

    Best wishes,
    Tobias

    Thread Starter jb01

    (@jb01)

    In case it helps anyone else, I’ve written a quick plugin to convert the TABLE output to DIV. It could be more elegant, but this gets the job done.

    Here’s the PHP code:
    https://pastebin.com/TAmP4LxF

    Steps:
    1) Create a folder “tablepress-divoutput” in your “plugins” folder in WordPress
    2) Create a file named “tablepress-divoutput.php” and copy and paste in the above code.
    3) Create a subfolder “css” and a file within that “tablepress-div.css”.

    Add any desired CSS code to that new file to style your output (required some CSS knowledge).

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    nice solution, thanks for sharing this!

    Best wishes,
    Tobias

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Output data in DIVs rather than TABLE’ is closed to new replies.