Okay
  Public Ticket #3726677
WPDT Shortcodes
Closed

Comments

  • Vlastimil Waic started the conversation

    Hi, I did not find an article dedicated to shortcodes attributes in the WPDT Documentation. I would like to display the same table on two pages of my website, but with different Default rows per page number. On my homepage I just want 10 records and a different number on the other page. It would be highle impractical for me to maintain two of the same table just because of this. Is there a shortcode attribute to change the number of rows? Is there a documentation about shortcode parametres? Thank you.

  •  1,846
    Miloš replied

    Hi Vlastimil,

    Sorry to disappoint you, but for this specific case of setting a different 'default rows per page' on the same table to be shown (with different table pagination) on different WP pages - we currently don't have a solution via shortcode parameter or any other built-in/out of the box option.


    It is a very interesting use-case, though, so you can make a development suggestion for it.

    Please feel free to search on our suggestions page

     to see if someone may be already suggested this feature. If you can't see it, feel free to add your suggestion there,  and as more people vote, the feature will move higher on the priority list.

    You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;

    and our newsletter, so you're informed about new features, bug fixes, freebies, etc.


    If you have coding skills and wish to try to make a custom solution now,

    you can check out our available hooks for Developers on this documentation and see if you can find any hook that might help.

    We also added this new developer's handbook, which can allow users with coding skills to make custom add-ons.

    Our developers will keep adding more custom hooks/examples there over time.


    Please be advised that custom solutions with hooks are not included in our support.

    You can also research resources such as Stack Overflow to see if any other user perhaps found a workaround.

    ( We do like to give examples for certain solutions, but for this use-case, we, unfortunately, don't have anything yet)


    So, for the time being, the only way to have different number of the 'default rows per page' in table pagination for different WP Pages is to create multiple tables.

    They can pull from the same data source, though - For example the same linked CSV/Google Sheet/Excel or similar;

    Or if you use editable tables - You can make one 'main Manual table', then create additional SQL Query table from it;

    It is going to pull the same data, so any editing is reflected on the same source, etc.


    2. We do have other parameters available in the Table shortcode, which can be used to pre-filter tables, such as with dynamic placeholders.

    I will demonstrate some examples of how tables can be pre-filtered :


    If you wish to try Pre-filtering tables through URL,  please check out this page with examples.


    You can also use placeholders for table generation.

    1. For example, if you have a MySQL query-based table, you can use this query:

    SELECT * FROM yourDatabaseTable
    WHERE columnName = '%VAR1%'

    %VAR1% can be defined in the Placeholders tab when you're creating a table, 

    or you can pass a different VAR1 value in the table's shortcode, like this :

    [wpdatatable id=1 var1='filter value']


    2. Or, if you don't add the condition in an SQL query ( or don't use an SQL Table),

    you can add %VAR1% in column settings -> Filtering, under "Predefined filtering value".

    Then, you can have different versions of the same table, with the VAR1 value passed in the shortcode,

    let's say if we had a "Regions" column and we wish to filter a different region per each page.

    9385158392.png

    If we want page 1 for example only filtered for "Region A" , you can set predefined filter to this column as %VAR1% (filter type has to be set as text) :

    4266306375.png

    Then for a page where we need only Region 1 filtered, use shortcode [wpdatatable id=1 var1='Region A'] ,

     page 2 for only "Region B", shortcode would be [wpdatatable id=1 var1='Region B'] and so on, 

    to apply the values defined in the shortcode to the filter.

    ( This filtering method can be used for any table type, besides Simple Tables)


    3. When it comes to general shortcodes and integration with major Page Builders, please check this Page.


    Let us know if you have any questions.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables