I would like to display a table about technical details of products on the frontend, editable in the page options, allowing to pre-filter the elements of this table with the information of a specific product. In my table: one row = one product Basically: to be able to do the same thing as the URL filter, but in the table display options in the site administration interface. Is this possible, and if so, how to do it? Thank you!
Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.
-
I am sorry, but not sure if i fully understood exactly what is needed for this use-case.
When you say in the back-end table settings, in the Display options,
the actual Display settings for a table are only for visual elements of the table, this is not the section where we can set any kind of filtering.
-
Generally speaking, there can be multiple ways how you can predefine a filter other than
SELECT * FROM yourDatabaseTable
WHERE columnName = '%VAR1%'
In your use-case, the columnName will be your "Product" column name, of course.
%VAR1% can be defined in the Placeholders tab when you're creating a table,
or you can pass VAR1 value in the table's shortcode.
-
For example if i have this Master Manual Table,
and i want to make a dynamic SQL Table with VAR1 placeholder. ( Then later i can input different VAR1 in the table shortcode on different pages).
First i check what is the Manual Table SQL name, under the Editing Tab.
My example SQL Query for the table will be :
SELECT * FROM wp_wpdatatable_44
WHERE company = '%VAR1%'
First, just to initially generate an SQL table with the VAR1 ,
i will set the Cakewalk company name in the VAR1 , in table's Placeholders tab :
-
Now, in the back-end, this table will render with that pre-filtered value.
-
Then, for the front-end, we can have a different filter.
For example, if i want to make a different page for another Company,
let's say "Adobe". Then i pass that value in the VAR1 of the table shortcode :
2.
Or, if you don't add the condition in an SQL query, 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)
Hello,
I would like to display a table about technical details of products on the frontend, editable in the page options, allowing to pre-filter the elements of this table with the information of a specific product.
In my table: one row = one product
Basically: to be able to do the same thing as the URL filter, but in the table display options in the site administration interface.
Is this possible, and if so, how to do it?
Thank you!
I'm also looking for that. Thanks!
Hi, CLÉMENT and Celestin.
Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.
-
I am sorry, but not sure if i fully understood exactly what is needed for this use-case.
When you say in the back-end table settings, in the Display options,
the actual Display settings for a table are only for visual elements of the table, this is not the section where we can set any kind of filtering.
-
Generally speaking, there can be multiple ways how you can predefine a filter other than
Pre-filtering tables through URL parameters.
1. You can use our dynamic placeholders for table generation.
It depends on what kind of table you have.
For example, if you have a MySQL query-based table, you can use this query:
In your use-case, the columnName will be your "Product" column name, of course.
%VAR1% can be defined in the Placeholders tab when you're creating a table,
or you can pass VAR1 value in the table's shortcode.
-
For example if i have this Master Manual Table,
and i want to make a dynamic SQL Table with VAR1 placeholder. ( Then later i can input different VAR1 in the table shortcode on different pages).
First i check what is the Manual Table SQL name, under the Editing Tab.
My example SQL Query for the table will be :
First, just to initially generate an SQL table with the VAR1 ,
i will set the Cakewalk company name in the VAR1 , in table's Placeholders tab :
-
Now, in the back-end, this table will render with that pre-filtered value.
-
Then, for the front-end, we can have a different filter.
For example, if i want to make a different page for another Company,
let's say "Adobe". Then i pass that value in the VAR1 of the table shortcode :
2.
Or, if you don't add the condition in an SQL query, 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)
-
I also made a short video example - please check it out here.
Let us know if that helps, or maybe you need a different solution,
in that case please elaborate in more details about the use-case and we can advise.
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