• Resolved N2Clic

    (@n2clic)


    Hey,

    Is it possible to add data-attributes to the <th> elements (inside <thead>)?

    I’m trying to use TablePress with FooTable and this jQuery plugin requires to add data-attributes on the above elements.

    Is there any to do that? Adding the required data-attributes with jQuery didn’t work, as the plugin can’t see them.

    Cheers

    https://www.ads-software.com/plugins/tablepress/

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

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    There’s no possibility for this via input fields, but you could use a plugin filter hook to add them via some string manipulation, e.g. by using the tablepress_cell_tag_attributes filter hook.

    However, the jQuery approach should also work, you will just need to make sure that the code runs before the FooTable JS code.

    Regards,
    Tobias

    Thread Starter N2Clic

    (@n2clic)

    Thanks for the prompt answer Tobias ??

    However regarding the jQuery approach, I could get it to work. I even tried to use the setTimeout() method. I’ll check with the guys who made footable to see if they can help.

    Do you know if there is any responsive add-on for TablePress? If not, we’d love to help creating one.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    using setTimeout() might actually work, but it should be easier to maybe change the dependencies of the loaded scripts, so that the script that adds the data- attributes is executed first, before the FooTable script.

    And yes, there is an Extension for Responsive Tables, which implements one common approach for responsiveness in tables: https://tablepress.org/extensions/responsive-tables/

    Regards,
    Tobias

    Thread Starter N2Clic

    (@n2clic)

    Thanks for the support. We actually got started today on a new extension based on FooTable. Hopefully we’ll have time to polish it this week and release it on the extend.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    very cool! I’m looking forward to checking it out!

    Best wishes,
    Tobias

    Hey Tobias,

    We just pushed v0.1.0 of the extension we’ve been working on this afternoon. There are very few FooTable data attributes supported right now but the mechanics was the most important. We’ll add more attributes later on.

    Meanwhile, any feedback / suggestion are welcome. Here is the repo: https://github.com/ThemeAvenue/TablePress-FooTable

    PS: Sorry for the username confusion, ThemeAvenue belongs to N2Clic, so we’re the same people ??

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for sharing that! Looks pretty solid! Great work!

    Best wishes,
    Tobias

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to add data attributes to columns in thead’ is closed to new replies.