I am testing out the plugin and 1 item that I either cannot figure out or it does not do. I am rebuilding some old code that basically does a spit out of a table and only shows, in my case Lic# FName LName. From there the Lic# is linkable to where it will "query" that specific entry and display all fields "Details" of the entry.
My question is can the plugin support query of the query if you want to call it that. I need to be able to show the results then be able to do a details view of a row.
wpDataTables can't generate another query when you click on an entry if that's what you mean.
There's a way to work around this. Let's look at the 2nd table first:
You would be able to create a table where Lic# will "query" that specific entry and display all fields "Details" of the entry. That table would have its own ID and shortcode. When you generate that table, you can assign one of the values to the %VAR1% placeholder and then modify the query to include a condition:
WHERE licNumber = %VAR1%
Now, the 1st table can be generated, but with a custom CONCAT function that would apply the Lic# to the page where the other table is, and update its VAR1 entry using dynamic placeholders. Please note that this does require some experience with writing SQL queries and using WP hooks.
You can create the 1st table with a query similar to this:
SELECT licNumber, Fname, Lname,
CONCAT('<a href="http:/yoursite.com/your_custom_page?license_number=',licNumber,'">Details</a>') AS Details
FROM your_table_name
Then, on your_custom_page you will insert a shortcode of the table ID that you need, with a placeholder like this:
[wpdatatable id=1 var1=1]
The second table (again) would be created from a query like this:
SELECT * FROM second_table WHERE licNumber = %VAR1%
After that, you can use a hook for dynamic placeholders:
function updateVAR1($tableID){
global $wdtVar1;
//check is set GET parametar licNumber
if(isset($_GET['licNumber'])){
//get value from form field
$wdtVar1 = $_GET['licNumber']; } }
add_action('wpdatatables_before_get_table_metadata', 'updateVAR1');
This is the only way you can achieve the results that you need.
I am testing out the plugin and 1 item that I either cannot figure out or it does not do. I am rebuilding some old code that basically does a spit out of a table and only shows, in my case Lic# FName LName. From there the Lic# is linkable to where it will "query" that specific entry and display all fields "Details" of the entry.
My question is can the plugin support query of the query if you want to call it that. I need to be able to show the results then be able to do a details view of a row.
Hey Christopher
Thank you for your interest in our plugin.
wpDataTables can't generate another query when you click on an entry if that's what you mean.
There's a way to work around this. Let's look at the 2nd table first:
You would be able to create a table where Lic# will "query" that specific entry and display all fields "Details" of the entry. That table would have its own ID and shortcode. When you generate that table, you can assign one of the values to the %VAR1% placeholder and then modify the query to include a condition:
Now, the 1st table can be generated, but with a custom CONCAT function that would apply the Lic# to the page where the other table is, and update its VAR1 entry using dynamic placeholders. Please note that this does require some experience with writing SQL queries and using WP hooks.
You can create the 1st table with a query similar to this:
Then, on your_custom_page you will insert a shortcode of the table ID that you need, with a placeholder like this:
[wpdatatable id=1 var1=1]
The second table (again) would be created from a query like this:
After that, you can use a hook for dynamic placeholders:
This is the only way you can achieve the results that you need.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
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