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

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    In the example from that link,

    $(document).ready(function () {
        $('#example').DataTable({
            scrollY: '50vh',
            scrollCollapse: true,
            paging: false,
        });
    });

    the lines inside the DataTable( { ... } ) function call are the “Custom Command”, i.e.

    "scrollY": '50vh',
    "scrollCollapse": true,
    "paging": false,

    (I prefer to also wrap the property values in " characters for better compatibility.)

    That said, for this particular example, you won’t need that, but can directly activate this feature by adding this parameter to the Shortcode (or the “Advanced” text field if you are using the “TablePress table” block in the block editor):

    datatables_scrolly=400px

    Regards,
    Tobias

    Thread Starter wordmax

    (@wordmax)

    Thanks for the tips. So the variables&values in shortcodes are the same as commands? I get how to do the shortcodes, that’s easy. But still not clear exactly what a typical use-case would be for a custom command to enter in the custom command field on the table’s setting in wp admin area.

    What would be a very simple basic example of a custom command to use for a table, where the table is being inserted into post using Gutenberg block option (not via manual shortcode).

    Sorry for the trouble. Just need an example I think it would clarify. Either that or a link to documentation on Tablepress site how to use custom commands.

    Thank you 🙂

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    So the variables&values in shortcodes are the same as commands?

    No! 🙂 The parameters and values in the Shortcode are used to control general plugin features. The “Custom Commands” ONLY apply to the JavaScript command of DataTables. You would add things there that directly influence DataTables. The code inside the DataTable( { ... } ) from my first reply would be a “Custom Command”. Now, for some common DataTables features, there is a Shortcode parameter as well, like that datatables_scrolly=400px one.

    The “Custom Commands” have nothing to do with the Gutenberg block. They are only ever added on a table’s “Edit” screen. Instead, the Gutenberg block (via the “Configuration parameters” field in the “Advanced” section in the block’s Settings sidebar) understand the Shortcode parameters as well (in the same syntax).

    Regards,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Examples of some custom commands for tables’ is closed to new replies.