Hey everyone!

With the holiday season upon us, we want to share our upcoming working hours:

After that, we’ll return to our regular schedule and assist you as quickly as possible.

In the meantime, you can explore our documentation for Amelia and wpDataTables. You'll find tons of helpful resources, including articles and handy video tutorials on YouTube (Amelia's YouTube Channel and wpDataTables' YouTube Channel), which might just have the answers you need while we’re away.

Thanks a bunch for your understanding and support!

Warm regards and happy holidays!

TMS

Okay
  Public Ticket #3431420
Placeholders in Manual Table
Closed

Comments

  • Amar started the conversation

    I have created a manual table with 2 columns - Year and Jobs

    I added a row as follows:

    • Year: 2023
    • Job: [state_job fy="2023" state="%VAR1%"]

    And to display this table, I used the following code

    echo do_shortcode( "[wpdatatable id=4 VAR1=AP]");


    In our [state_job] shortcode, we're receiving the attribute as %VAR1% instead of AP. 

    wpDataTable is not replacing %VAR1% with AP

    Is placeholder won't work in this case? 

    Attached files:  state.php 2023-08-07 17-24-34.png
      Create a Table.png
      localhost:8888 : localhost : wp_wpdatatable_4 | phpMyAdmin.png

  •  1,847
    Miloš replied

    Hi Amar,

    sorry to disappoint you, but it is not possible to use the VAR placeholders in this way.

    Here are some of the ways how VAR is generally used (and other placeholders);

    You can 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 someColumn = %VAR1%

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

    8543595926.png


    You can also alter this in the shortcode. 


    2. Or,  if you don't add the condition in the query,

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

    For example, in this Table in the "Countries" Column :

    7884293880.png
    5028613944.png


    Then, when you add the table to a page, you can use [wpdatatable id=1 var1=USA] on one page if we want to predefine to filter just rows of "USA" on table load,

    or  [wpdatatable id=1 var1=Germany]  on a page where we want to just pre-filter Country as Germany

    and so on, to apply the values defined in the shortcode to the filter.

    -

    So, in your case, if you have a Column that holds rows with "State" values;

    you can do the same and then pass "VAR1=value you need".

    -

    Let me know if that helps.


    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

  • Amar replied

    Unfortunately, a predefined filtering value won't work in our case since we're only showing the count in the column.

    It would be great if we can use the variables in cells too. Hope it will be supported in the next updates.

    Or is there any filter where we can do a simple search and replace of cell content before returning it to wpDataTable?

  •  1,847
    Miloš replied

    Hi Amar,

    as far as i am aware, we do not have a simple search and replace method,

    at least i can't find any from our working examples or custom workarounds we got from our other users.

    -

    We do have this Conditional Formatting, though, which can be used to look for a certain condition in cells of a Column, and then you can set certain actions, such as transforming content of the cell, changing cell, column or row color, adding CSS class etc,

    please check more on this here.

    -

    But i am guessing you meant something more complex/different,

    such as a 'search and replace' placeholder?

    Could you perhaps elaborate a bit more, if you can add any kind of examples and screenshots, or a Video,

    just to be sure we understand the use case,

    then i can ask our developers if they know of any way to achieve it?

    Thank you.


    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

  • Amar replied

    Hi

    The use case is very simple. We just want to use the placeholder inside the cells too (in the manual table)

    Let's take the following example: (Assume use wanted to do this only with a manual table)

    We wanted to show a table on a page that shows the earnings of various products in a particular month. We wanted to use it on multiple pages with different months. (For monthly overview article)

          Product           ______     Earnings

         Product A        ----------     [product_info type="earnings" month="%VAR1%" id="A"]

         Product B        ----------     [product_info type="earnings" month="%VAR1%" id="B"]

         Product C        ----------     [product_info type="earnings" month="%VAR1%" id="C"]

         Product D        ----------     [product_info type="earnings" month="%VAR1%" id="D"]

         Product F        ----------     [product_info type="earnings" month="%VAR1%" id="E"]


    Under the earnings column, we're using the shortcode [product_info] which displays the earnings value based on month and ID values.

    In this case, we wanted to send the monthly value as a placeholder 

    [wpdatatable id=4 VAR1=082023]


    While rendering the Table, wpDataTable should execute our shortcode as 

    [product_info type="earnings" month="082023" id="A"]


    However, currently, it is executing the shortcode as 

    [product_info type="earnings" month="%VAR1%" id="A"]


    We can do this, we can reuse the same table multiple times on different pages.


    Similarly, we wanted to use the placeholders in table headers 

         Product           ______     %VAR3%


    We can use the same manual table to display the Sales count too in the following way:


    [wpdatatable id=4 VAR1=082023 VAR2="sales" VAR3="Total Sales"]

    [product_info type="%VAR2%" month="%VAR1%" id="A"]


    This should output, table headers as 

         Product           ______    Total Sales


    and execute the shortcode as

    [product_info type="sales" month="082023" id="A"]



    Hope it helps.

  •  1,847
    Miloš replied

    Hi Amar,

    thank you for clarifying the use case, i see what you mean.

    Unfortunately, it is not possible to use our current built-in Placeholder capabilities like this,

     directly placing the %VAR1% inside the table cells.

    The %VAR1%  can only be used as a predefined filter on an entire Column,

    but i think this is a good idea for future development.


    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.

    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.

    Maybe this can be done with some custom work, but our developers are very busy at the moment, working on some priority tasks and fixing bugs and issues with our plugins, so they won't be having the time for custom work in the near future.

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



    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