Did anyone try to embed Datatables into Topic Body?

Datatables is a jQuery plugin. jQuery plugins can be implemented quite easily in Discourse. There are a couple of examples of this like the Tiles and Slick gallery theme components.

Essentially, what you need to do is to create a decorator for posts that contain tables that you want to target with dataTables.

I’ve created an example of how you can do that here

and created a preview for it on theme creator here

https://theme-creator.discourse.org/theme/Johani/discourse_datetables

It’s obviously a bit basic for now, and it’s missing some styles but it should be a good starting point as sorting, searching and pagination work just fine.

12 לייקים