I've noticed when calling shortcode for a table, it always calls it from the table assuming the placeholders are their default values, instead of, for example calling it from the table after the non-default placeholder values are used in the query.
The way we are using the placeholders is when calling the query from the database (MYSQL) and we use the %VAR1% etc. as a search parameter in the WHERE clause.
Not sure if I'm just using the shortcode wrong but if this is possible to have the shortcode search the table using the non-default value (after page load) it would be a fantastic help!
Another thing to note is we are using the master detail plugin to allow us to push the values into the new page by clicking a row from the table of the previous page and these are passed onto the table from here.
To begin, I want to extend my heartfelt apologies for the delayed reply,
which is due to an unexpectedly high volume of inquiries.
We truly value your patience during this period.
-
I will first show you some examples, how you can pre-filter our Tables, with the VAR Placeholder with and without SQL Queries - how you need to first give it a default value to generate the SQL Table - but later you can pass a different VAR value in your Table Shortcode.
Here are the examples, and let me know if there is any issue still after trying to apply them on your Table :
There can be different ways to pre-filter tables in our plugin :
SELECT * FROM yourDatabaseTable
WHERE columnName = '%VAR1%'
%VAR1% needs to be defined in the Placeholders tab when you're creating a table,
and you can pass a different VAR1 value in the table's shortcode if needed.
( Use-Case would be to have different Pages filtered for different VAR value, for example)
You can pass it through the Table shortcode on a Page, something like :
[ wpdatatable id=12 var1='another Value']
This way, the Table loads that 'default VAR' value to generate the Table on Back-End, but on Front-End, you can pass any different value for VAR1 in the Shortcode.
-
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.
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) :
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)
Let me know if that helps to achieve your goal?
2. Another thing to note is we are using the master detail plugin to allow us to push the values into the new page by clicking a row from the table of the previous page and these are passed onto the table from here.
I am not sure I understood this part of the Use-Case.
If you simply wish the Table to pass the current values from a row, when the row is clicked, to the Master Details Template Page - this is the default behaviour, as explained in this Documentation.
But if you are trying something different, please elaborate and show us more details.
I've noticed when calling shortcode for a table, it always calls it from the table assuming the placeholders are their default values, instead of, for example calling it from the table after the non-default placeholder values are used in the query.
The way we are using the placeholders is when calling the query from the database (MYSQL) and we use the %VAR1% etc. as a search parameter in the WHERE clause.
Not sure if I'm just using the shortcode wrong but if this is possible to have the shortcode search the table using the non-default value (after page load) it would be a fantastic help!
Another thing to note is we are using the master detail plugin to allow us to push the values into the new page by clicking a row from the table of the previous page and these are passed onto the table from here.
Thanks!
Ian
Hi Ian,
To begin, I want to extend my heartfelt apologies for the delayed reply,
which is due to an unexpectedly high volume of inquiries.
We truly value your patience during this period.
-
I will first show you some examples, how you can pre-filter our Tables, with the VAR Placeholder with and without SQL Queries - how you need to first give it a default value to generate the SQL Table - but later you can pass a different VAR value in your Table Shortcode.
Here are the examples, and let me know if there is any issue still after trying to apply them on your Table :
There can be different ways to pre-filter tables in our plugin :
1. If you wish to try Pre-filtering tables through URL, please check out this page with examples.
-
2. You can also use placeholders for table generation. ( *This one is more specific to your Use-Case)
1. For example, if you have a MySQL query-based table, you can use this query:
%VAR1% needs to be defined in the Placeholders tab when you're creating a table,
and you can pass a different VAR1 value in the table's shortcode if needed.
( Use-Case would be to have different Pages filtered for different VAR value, for example)
You can pass it through the Table shortcode on a Page, something like :
[ wpdatatable id=12 var1='another Value']
This way, the Table loads that 'default VAR' value to generate the Table on Back-End, but on Front-End, you can pass any different value for VAR1 in the Shortcode.
-
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.
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) :
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)
Let me know if that helps to achieve your goal?
2. Another thing to note is we are using the master detail plugin to allow us to push the values into the new page by clicking a row from the table of the previous page and these are passed onto the table from here.
I am not sure I understood this part of the Use-Case.
If you simply wish the Table to pass the current values from a row, when the row is clicked, to the Master Details Template Page - this is the default behaviour, as explained in this Documentation.
But if you are trying something different, please elaborate and show us more details.
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 | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia 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