• Resolved David

    (@dtcblyth)


    Hi Tobias,

    I hope you are well. I’m currently writing some PHP functions for generating TablePress tables via shortcodes and I have some general question regarding TablePress and table headers.

    It’s seems as a general rule that in order to activate TablePress DataTable related features (and most of the TablePress Extensions) a table needs to have table headers activated. Essentially, any TablePress shortcode that is prefixed with datatables_ requires that the table header is active. Is this true?

    Also, it seems that the use_datatables shortcode doesn’t necessarily need to be set to true for DataTables features to work. However, it can be set to false to de-activate all DataTable features at once. Is that also true?

    I appreciate your time. 🙂

    Kind regards,
    David.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    First a remark: When using custom PHP code, it’s often better to not use the Shortcode and have it parsed, but to directly call the Shortcode handler PHP function (which also serve as “Template Tag functions”), see https://tablepress.org/faq/documentation-template-tag-functions/

    Regarding your questions:

    Yes, the Table Header must always be present in the HTML code whenever using DataTables or an Extension that is based on it. This is a requirement by DataTables. (Depending on the chosen features and Extensions, it’s often possible to leave the content of the header row cells empty and to hide it with CSS code, if it’s not desired.)

    For use_datatables: I recommend to always set it to true, when DataTables is involved. For some Extensions, I have changed the code so that they internally set this to true, even if the user did not check the checkbox (to reduce friction for inexperienced users).

    Regards,
    Tobias

    Thread Starter David

    (@dtcblyth)

    Hi Tobias,

    Thanks for your quick and clear response, as usual!

    Actually, I am using the Template Tag functions, I just said shortcodes as I thought it was perhaps the easiest way of clarifying my question… I don’t know why. 🙂 Thanks for the advice though!

    Thanks for the explanation on the use_datatables property… I’ll keep that in mind too.

    All the best,
    David.

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! 🙂 Good to hear that this helped!

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Table Headers and DataTable/Extenions…’ is closed to new replies.