I would like to use your developer filter or action to filter a table before it is rendered on the page either by using an Elementor form or a separate wpData table inserted on the Elementor page. The 2nd table (filtered) could be on a separate page although I would prefer it to be on the same page. The data is from a MYSQL query so I was looking at wpdatatables_filter_mysql_query( $query, $tableId ) & wpdatatables_before_get_table_metadata( $tableId ).
Using filters and hooks is not included in the provided support for the plugin as it requires a certain level of programming skills.
Here's an example for you, but you need to replace it with values from your tables if you have an SQL query based table:
SELECT * FROM wp_wpdatatable_1
You can use the hook to display only certain columns, like this:
function table_filtering($query,$table_id) {
if ( $table_id == 3 ) {
$query = "SELECT * FROM ht_clientinfo where clientID = '9444'";
}
return $query;
}
add_filter('wpdatatables_filter_mysql_query', 'table_filtering',10,2);
But, why wouldn't you do this with placeholders instead? It should be a simpler solution.
So, you can assign %VAR1% as a predefined filtering value to clientID column (under column settings/filtering), and then change it through the shortcode:
Thank you. I've been traveling so been delayed in responding. I like using the placeholder but can you set %VAR1% dynamically? For example selecting a clientID from another table, or from a field on an Elementor page?
We don't have this built-in yet, but you can with a workaround. Please note that this does require some experience with writing SQL queries and using WP hooks.
You can create a table with a query like this:
SELECT user_id, user_name, user_address,
CONCAT('<a href="http:/yoursite.com/your_custom_page?user_id=',user_id,'">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 would be created from a query like this:
SELECT * FROM second_table WHERE user_id = %VAR1%
After that, you can use a hook for dynamic placeholders:
function updateVAR1($tableID){
global $wdtVar1;
//check is set GET parametar user_id
if(isset($_GET['user_id'])){
//get value from form fieald
$wdtVar1 = $_GET['user_id'];
}
}
add_action('wpdatatables_before_get_table_metadata', 'updateVAR1');
I hope this helps you achieve the results that you need.
1. You need to assign %VAR1% to something. In order to filter a certain column per value of %VAR1%, that needs to be added as a predefined filtering value in the column:
2. If there's only one table on the page, it doesn't require the table ID.
3. It's not required, but you can add it, if you have multiple tables on the same page, of course.
1. Your screenshot is different from mine, maybe because I am using SQL as data?
I added a value to %VAR1% to the ClientInfo table. 2. I am using another table ON THE SAME PAGE named ChooseClient to choose the client from the clientID column.
You're looking at the placeholders tab above the table, while my screenshot is from Column Settings/Filtering.
The %VAR1% value should remain empty if you don't want the table to be automatically filtered with it when you add "%VAR1%" to column settings, under "Predefined filtering value" because you'll pass its value in the shortcode.
Is the shortcode correct? If I use [wpdatatable id=3 var1=1], I get all clientIDs with a "1". If I change it to [wpdatatable id=3 var1=9], I get all clientIDs with a "9". The selected url from the 1st table shows the correct client ID.
Somehow we have gotten everything confused. Can we start from the beginning?
1. I would like to use wpdatatables_filter_mysql_query 2. 2 tables on the same page 3. 1st table would show clientIDs with a url link 4. 2nd table would show client details 5. The selection from table 1 should filter table 2
The 1st table's SQL is:
SELECT ht_clientinfo.`clientID`, ht_clientinfo.`lastname`, ht_clientinfo.`firstname`, ht_clientinfo.`middlename`, CONCAT('<a href="http:/thewellnessbridge.com/healthtrak_editstartinginfo?clientID=',clientid,'">Details</a>') AS Details FROM ht_clientinfo
No Placeholder nor Predefined filter
How should the 2nd table be configured? Any placeholder or Preconfigured value?
Again, the 2 tables are on the same page if that makes a difference.
I found an error in my functions.php that was preventing filters from executing properly. Here is my code for wpdatatables_filter_mysql_query;
function table_filtering($query,$table_id) { global $client; //check is set GET parametar clientID if(isset($_GET['clientID'])){ //get value from form field $client = $_GET['clientID']; } if ( $table_id == 3 ) { $query = "SELECT * FROM ht_clientinfo where clientID = '$client'"; //$query = "SELECT * FROM ht_clientinfo where clientID = 'hladek1234'"; } return $query; } add_filter('wpdatatables_filter_mysql_query', 'table_filtering',10,2);
It works if I set the value to hladek1234, but not for $clientID. clientID is found correctly as I test it using a php code snippet.
If you're referring to loading the pages for the first time, and there's no forwarded GET parameter, then yes, since in the logic (in your function) you're asking if the GET parameter is set, and if it isn't, the client variable will be empty; it then goes into your second condition, where it asks if the table with ID3 is (the one on the page) and packs the query with an empty client variable, and that's why you're getting the empty table on load.
Only the GET parameter is being forwarded by clicking the link in the first table, as far as we can see.
It may be better to change the logic, only if the clientid is set, and if there's a table with ID3 on the page, to pack the query. Something like this:
function table_filtering($query,$table_id) { global $client; //check is set GET parametar clientID if(isset($_GET['clientID'])){ //get value from form field $client = $_GET['clientID']; if ( $table_id == 3 ) { $query = "SELECT * FROM ht_clientinfo where clientID = '" . $client . "'"; } } return $query; } add_filter('wpdatatables_filter_mysql_query', 'table_filtering',10,2);
I have echoed $query & it does not appear to be correct no matter how it is configured. Could you have your developers see if they can get it to create a valid query?
I'm sorry to disappoint you, John, but creating custom queries is not included in the provided support for the plugin.
They can check the code you added, though. Can you clone your website?
If yes - I'll ask you to install the Duplicator plugin. It will generate a couple of files that you can send me (along with the log-in credentials), and then I can create an exact copy of your website, see what the issue is and try to resolve it.
If the Duplicator plugin fails (the free version works for sites up to 500MB), you can use the All-in-One WP Migration plugin.
The files will be too large to attach to the ticket, so you can upload them via wetransfer.com and just send me the link.
Also, make sure to provide us with a detailed description - which table is this for, on which page is it located, which theme is being used, and what exactly do you need from it?
Please note that this is a public ticket, so make sure to enable the PRIVATE response.
1. I am not asking for a custom query, I just want to know that wpdatatables_filter_mysql_query works! If your developers can filter a table based on $_GET, I would like to see their code.
2. Also, I am able to get wpdatatables_before_get_table_metadata to work, but only when the clientID is a number even through the field is varchar. clientID '5040 'works but clientID 'hladek5040' does not.
I am being persistent because I have several clients where I believe wpdatatables would be a valuable tool.
This filter definitely works, as it's been sent to other customers before you multiple times. You're still passing the variable as a string, that's why an integer (5040) works, but a string (h;adek5040) doesn't work. You need to adjust the code for a string.
Our developers will gladly take a look at this, and try to find the issue in your code, but they need to see everything that you see - so, since the Duplicator failed, can you please use the All-in-One WP Migration plugin to duplicate your site?
Again, we'll need a detailed description - which table is this for, on which page is it located, which theme is being used, where the code is, and what exactly do you need from it?
We're missing one of the database tables in the duplicator "ht_clientinfo". Can you please just access your database using phpMyAdmin (or any other tool that you may be using for database management), export that table, and send it to us?
Make sure to enable the private response when you respond.
You don't need the hook for the MySQL query if this is what you need.
String data wasn't returned into VAR1 because you didn't add the single quotes around the placeholder in the query.
When this is modified, you'll not be able to save the table because you set the clientId as the value of VAR1, and it doesn't exist. Change that and include an existing value from the table as long as the table is generated. Then, on the page crudeditclient add the shortcodes of the two tables that you need, and for the table client info forward the value of VAR1 (for example test, or anything else if you need this table to be without data on the load of the page). Then, when you click on details above the table in the client info table, the GET data will be forwarded and the table will be filtered. Please check the attachments.
If this is not what you need, please explain the flow in more detail so we can see how it can be done.
Now I have a problem when editing the client & this is even on the dashboard. When I edit a client & click OK, it tries to Add a new client & because I have the column clientID as a primary key, I get an error that a new record cannot be added. It should be updating that row not inserting a new row. I even created a new wpdatatable & it acts the same. Am I doing something wrong during the creation of a table?
Just wondering how you got on with this, I have the same issue, and I've tried to go through the steps and replace what you've done to select a client in the top table for it to populate the second, but having no luck. Do you think you could talk me through this as the info from TMS is extremely confusing.
Hi Michael. I agree that answers seem to be confusing & slow in coming. Here is what is working for me: 1. Main table has the following SQL statement - SELECT * FROM ht_clientinfo WHERE clientid = '%VAR1%' (note the single quotes around %VAR1) **My database table has a primary key on the column clientID 2. Under the "Placeholders" tab, enter one of your values into %VAR1% for the row you want to filter on. In my case the database table column is clientID & the value I chose was hladek9444. It doesn't matter which clientID is chosen because it will be overwritten when added to Elementor, but one value has to be selected or the table will not be created. Quirk of wpdataTables. After the table is created, if you scroll down you will only see 1 record, the one with the value you added to %VAR1%. 3. Create your Select table to select a row. I made it a subset of the table created above but regardless it MUST have the column containing values you will be using to filter on. In my case clientID. Here is the SQL statement: SELECT ht_clientinfo.`clientid`, ht_clientinfo.`lastname`, ht_clientinfo.`firstname`, ht_clientinfo.`middlename`, CONCAT('a href ="http://thewellnessbridge.com/crudeditclient?clientid=',clientid,'">Details</a>') AS Details FROM ht_clientinfo The a href points to the Elementor page containing the Main table above. In my case crudeditclient. It sets the variable equal to the clientID on that row. 4. Add the Select table to your Elementor page using the wpdataTables widget. Don't change anything. 5. Add the Main table to your Elementor page using the wpdataTables widget. Under "Set placeholder %VAR1%" enter "test". Because there is no value "test" in the client column in the database, the table will come in with "No matching records found" if you go to the page directly. However, if you go to the page using the link on the Select table, the Main table should show the row matching the value you select in table 2.
Everything above is working for me. However, now I am having trouble editing the row. It wants to add a row instead of updating the row. This happens even on the dashboard so it's not related to the above process.
Please feel free to contact me if I can help in any way.
I found that you have to have an auto increment integer primary key column in your mysql table in order to edit. You also have to set that column to the "ID column for editing" under the Editing tab.
Aleksandar - You can close this ticket. Thank you for your help. I have attached a document that explains the steps needed to get this to work. Please view it to be sure it is accurate.
I have a very similar issue as John had in 2021 which I cannot get to work. Is it possible for you share the document that John mentions on 16 Nov 2021 below so that I may check where I am going wrong? I have followed his steps posted on 13 Nov 2021 but still missing something. By the way unlike John I am not seeking to edit the record.
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.
-
Since this is a very old ticket, we are not sure if we will be able to contact John / if he will see our new correspondence here, but we should be able to help you with your use-case.
Also, in the meantime, we released quite a few Updates to our Plugin with some new Features/options, although we did not release any new major options on this subject of using filtering with Placeholders, etc.
-
The best way to handle this situation is, if you can please open a new ticket and show us more details along with screenshots, what kind of Table did you make, we presume an SQL Query based Table;
And how did you setup your Placeholders, we presume you will be using one of the VAR placeholders with the Query, right?
And also, do you plan to use a Custom Hook as John did in order to pull a filtering value from a GET parameter, etc?
If you can elaborate in more details about your specific use-case, and add any screenshots, or even better, a Video, that can help.
If the images or Video show any sensitive Data, please send it as a PRIVATE message, for safety, then only we can see it.
And if you make a Video that is large for an attachment, just upload it to weTransfer and send us a download link.
I would like to use your developer filter or action to filter a table before it is rendered on the page either by using an Elementor form or a separate wpData table inserted on the Elementor page. The 2nd table (filtered) could be on a separate page although I would prefer it to be on the same page. The data is from a MYSQL query so I was looking at wpdatatables_filter_mysql_query( $query, $tableId ) & wpdatatables_before_get_table_metadata( $tableId ).
How can I get the selected value to use?
The below was added to th4e theme functions but the table does not show the filtered data,
add_filter('wpdatatables_filter_mysql_query', 'wpfilterdata');
function wpfilterdata( $query, $tableID){
$query = 'SELECT * FROM ht_clientinfo where clientID = "9444"';
$tableID = '3';
return $query;
}
Hello John.
Thank you for your purchase.
Using filters and hooks is not included in the provided support for the plugin as it requires a certain level of programming skills.
Here's an example for you, but you need to replace it with values from your tables if you have an SQL query based table:
You can use the hook to display only certain columns, like this:
But, why wouldn't you do this with placeholders instead? It should be a simpler solution.
So, you can assign %VAR1% as a predefined filtering value to clientID column (under column settings/filtering), and then change it through the shortcode:
[wpdatatable id=1 var1=9444]
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
Thank you. I've been traveling so been delayed in responding. I like using the placeholder but can you set %VAR1% dynamically? For example selecting a clientID from another table, or from a field on an Elementor page?
Hi again John
We don't have this built-in yet, but you can with a workaround. Please note that this does require some experience with writing SQL queries and using WP hooks.
You can create a table with a query like 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 would be created from a query like this:
After that, you can use a hook for dynamic placeholders:
I hope this helps you 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
I have tried the below but I get no results. I've tried to determine the problem but no luck. The link does provide a user_ID in it.
1. Is [wpdatatable id=1 var1=1] for the 2nd table (filtered by 1st)?
2. Doesn't the function require a tableID?
3. The action wpdatatables_before_get_table_metadata( $tableId ) also seems to require a tableID.
Hello John
1. You need to assign %VAR1% to something. In order to filter a certain column per value of %VAR1%, that needs to be added as a predefined filtering value in the column:
2. If there's only one table on the page, it doesn't require the table ID.
3. It's not required, but you can add it, if you have multiple tables on the same page, of course.
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
Thanks for your reply.
1. Your screenshot is different from mine, maybe because I am using SQL as data?
I added a value to %VAR1% to the ClientInfo table.
2. I am using another table ON THE SAME PAGE named ChooseClient to choose the client from the clientID column.
Hello John
You're looking at the placeholders tab above the table, while my screenshot is from Column Settings/Filtering.
The %VAR1% value should remain empty if you don't want the table to be automatically filtered with it when you add "%VAR1%" to column settings, under "Predefined filtering value" because you'll pass its value in the shortcode.
Please let me know how it goes.
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
Is the shortcode correct? If I use [wpdatatable id=3 var1=1], I get all clientIDs with a "1". If I change it to [wpdatatable id=3 var1=9], I get all clientIDs with a "9". The selected url from the 1st table shows the correct client ID.
This looks good.
So, to sum up - if you added %VAR1% as a predefined filtering value in clientID column, these shortcodes should do exactly what you ask:
[wpdatatable id=3 var1=1] show user with ID:1
[wpdatatable id=3 var1=9] show user with ID:9
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
Somehow we have gotten everything confused. Can we start from the beginning?
1. I would like to use wpdatatables_filter_mysql_query
2. 2 tables on the same page
3. 1st table would show clientIDs with a url link
4. 2nd table would show client details
5. The selection from table 1 should filter table 2
The 1st table's SQL is:
SELECT ht_clientinfo.`clientID`, ht_clientinfo.`lastname`, ht_clientinfo.`firstname`, ht_clientinfo.`middlename`, CONCAT('<a href="http:/thewellnessbridge.com/healthtrak_editstartinginfo?clientID=',clientid,'">Details</a>') AS Details FROM ht_clientinfo
No Placeholder nor Predefined filter
How should the 2nd table be configured? Any placeholder or Preconfigured value?
Again, the 2 tables are on the same page if that makes a difference.
I found an error in my functions.php that was preventing filters from executing properly. Here is my code for wpdatatables_filter_mysql_query;
function table_filtering($query,$table_id) {
global $client;
//check is set GET parametar clientID
if(isset($_GET['clientID'])){
//get value from form field
$client = $_GET['clientID'];
}
if ( $table_id == 3 ) {
$query = "SELECT * FROM ht_clientinfo where clientID = '$client'";
//$query = "SELECT * FROM ht_clientinfo where clientID = 'hladek1234'";
}
return $query;
}
add_filter('wpdatatables_filter_mysql_query', 'table_filtering',10,2);
It works if I set the value to hladek1234, but not for $clientID. clientID is found correctly as I test it using a php code snippet.
Thanks for that, John
I forwarded the ticket to one of our developers, and as soon as I hear something I will let you know.
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
Hi again John.
Our developer could only see that the PHP global variable has been forwarded as a string.
Please try this:
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
That did NOT work. Could you have your developers check to see if they can use $_GET to set a value in a query for a table they have created?
Hello John.
If you're referring to loading the pages for the first time, and there's no forwarded GET parameter, then yes, since in the logic (in your function) you're asking if the GET parameter is set, and if it isn't, the client variable will be empty; it then goes into your second condition, where it asks if the table with ID3 is (the one on the page) and packs the query with an empty client variable, and that's why you're getting the empty table on load.
Only the GET parameter is being forwarded by clicking the link in the first table, as far as we can see.
It may be better to change the logic, only if the clientid is set, and if there's a table with ID3 on the page, to pack the query. Something like this:
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
I have echoed $query & it does not appear to be correct no matter how it is configured. Could you have your developers see if they can get it to create a valid query?
I'm sorry to disappoint you, John, but creating custom queries is not included in the provided support for the plugin.
They can check the code you added, though. Can you clone your website?
If yes - I'll ask you to install the Duplicator plugin. It will generate a couple of files that you can send me (along with the log-in credentials), and then I can create an exact copy of your website, see what the issue is and try to resolve it.
If the Duplicator plugin fails (the free version works for sites up to 500MB), you can use the All-in-One WP Migration plugin.
The files will be too large to attach to the ticket, so you can upload them via wetransfer.com and just send me the link.
Also, make sure to provide us with a detailed description - which table is this for, on which page is it located, which theme is being used, and what exactly do you need from it?
Please note that this is a public ticket, so make sure to enable the PRIVATE response.
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
I tried Duplicator but it failed.
1. I am not asking for a custom query, I just want to know that wpdatatables_filter_mysql_query works! If your developers can filter a table based on $_GET, I would like to see their code.
2. Also, I am able to get wpdatatables_before_get_table_metadata to work, but only when the clientID is a number even through the field is varchar. clientID '5040 'works but clientID 'hladek5040' does not.
I am being persistent because I have several clients where I believe wpdatatables would be a valuable tool.
Hi again John
This filter definitely works, as it's been sent to other customers before you multiple times. You're still passing the variable as a string, that's why an integer (5040) works, but a string (h;adek5040) doesn't work. You need to adjust the code for a string.
Our developers will gladly take a look at this, and try to find the issue in your code, but they need to see everything that you see - so, since the Duplicator failed, can you please use the All-in-One WP Migration plugin to duplicate your site?
Again, we'll need a detailed description - which table is this for, on which page is it located, which theme is being used, where the code is, and what exactly do you need from it?
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
I sent the file along with a text file explaining how I am using wpDataTables & the problems I am having.
Thanks, John.
I forwarded it to our development team, and as soon as I hear from them I will let you know.
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
Hello John
I apologize for the late response.
We're missing one of the database tables in the duplicator "ht_clientinfo". Can you please just access your database using phpMyAdmin (or any other tool that you may be using for database management), export that table, and send it to us?
Make sure to enable the private response when you respond.
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
Thanks John, I forwarded it to our development team, and as soon as I hear from them I will let you know.
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
Hello again John.
Sorry for the late response.
You don't need the hook for the MySQL query if this is what you need.
String data wasn't returned into VAR1 because you didn't add the single quotes around the placeholder in the query.
When this is modified, you'll not be able to save the table because you set the clientId as the value of VAR1, and it doesn't exist. Change that and include an existing value from the table as long as the table is generated. Then, on the page crudeditclient add the shortcodes of the two tables that you need, and for the table client info forward the value of VAR1 (for example test, or anything else if you need this table to be without data on the load of the page). Then, when you click on details above the table in the client info table, the GET data will be forwarded and the table will be filtered. Please check the attachments.
If this is not what you need, please explain the flow in more detail so we can see how it can be done.
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
This works for selecting the client.
Thank you.
Now I have a problem when editing the client & this is even on the dashboard. When I edit a client & click OK, it tries to Add a new client & because I have the column clientID as a primary key, I get an error that a new record cannot be added. It should be updating that row not inserting a new row. I even created a new wpdatatable & it acts the same. Am I doing something wrong during the creation of a table?
Hi John,
Just wondering how you got on with this, I have the same issue, and I've tried to go through the steps and replace what you've done to select a client in the top table for it to populate the second, but having no luck. Do you think you could talk me through this as the info from TMS is extremely confusing.
Hi Michael. I agree that answers seem to be confusing & slow in coming. Here is what is working for me:
1. Main table has the following SQL statement -
SELECT * FROM ht_clientinfo WHERE clientid = '%VAR1%' (note the single quotes around %VAR1)
**My database table has a primary key on the column clientID
2. Under the "Placeholders" tab, enter one of your values into %VAR1% for the row you want to filter on. In my case the database table column is clientID & the value I chose was hladek9444. It doesn't matter which clientID is chosen because it will be overwritten when added to Elementor, but one value has to be selected or the table will not be created. Quirk of wpdataTables. After the table is created, if you scroll down you will only see 1 record, the one with the value you added to %VAR1%.
3. Create your Select table to select a row. I made it a subset of the table created above but regardless it MUST have the column containing values you will be using to filter on. In my case clientID. Here is the SQL statement:
SELECT ht_clientinfo.`clientid`, ht_clientinfo.`lastname`, ht_clientinfo.`firstname`, ht_clientinfo.`middlename`, CONCAT('a href ="http://thewellnessbridge.com/crudeditclient?clientid=',clientid,'">Details</a>') AS Details FROM ht_clientinfo
The a href points to the Elementor page containing the Main table above. In my case crudeditclient. It sets the variable equal to the clientID on that row.
4. Add the Select table to your Elementor page using the wpdataTables widget. Don't change anything.
5. Add the Main table to your Elementor page using the wpdataTables widget. Under "Set placeholder %VAR1%" enter "test". Because there is no value "test" in the client column in the database, the table will come in with "No matching records found" if you go to the page directly. However, if you go to the page using the link on the Select table, the Main table should show the row matching the value you select in table 2.
Everything above is working for me. However, now I am having trouble editing the row. It wants to add a row instead of updating the row. This happens even on the dashboard so it's not related to the above process.
Please feel free to contact me if I can help in any way.
I found that you have to have an auto increment integer primary key column in your mysql table in order to edit. You also have to set that column to the "ID column for editing" under the Editing tab.
Hi John, thanks for this - I'll have a go today. Can you inbox me over at [email protected] to take this conversation off line? Thx
I'm glad to see you guys were able to work together on this.
John, I just want to know if there's anything we can do for you about the issue from the title of the ticket, or should we consider this resolved?
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
Aleksandar - You can close this ticket. Thank you for your help. I have attached a document that explains the steps needed to get this to work. Please view it to be sure it is accurate.
Seems fine to me, John, thanks for sharing that with everyone!
If you have any further questions or issues, please feel free to open a new ticket, and we'll gladly help.
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
Hello Aleksandar & John Hladek
I have a very similar issue as John had in 2021 which I cannot get to work. Is it possible for you share the document that John mentions on 16 Nov 2021 below so that I may check where I am going wrong? I have followed his steps posted on 13 Nov 2021 but still missing something. By the way unlike John I am not seeking to edit the record.
Thank you very much
Graham Wilkie
Hi Graham,
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.
-
Since this is a very old ticket, we are not sure if we will be able to contact John / if he will see our new correspondence here, but we should be able to help you with your use-case.
Also, in the meantime, we released quite a few Updates to our Plugin with some new Features/options, although we did not release any new major options on this subject of using filtering with Placeholders, etc.
-
The best way to handle this situation is, if you can please open a new ticket and show us more details along with screenshots, what kind of Table did you make, we presume an SQL Query based Table;
And how did you setup your Placeholders, we presume you will be using one of the VAR placeholders with the Query, right?
And also, do you plan to use a Custom Hook as John did in order to pull a filtering value from a GET parameter, etc?
If you can elaborate in more details about your specific use-case, and add any screenshots, or even better, a Video, that can help.
If the images or Video show any sensitive Data, please send it as a PRIVATE message, for safety, then only we can see it.
And if you make a Video that is large for an attachment, just upload it to weTransfer and send us a download link.
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