or you can add a filter through the shortcode if you assign one of our placeholders to column settings/filters/predefined filtering value.
If you add %VAR1% as a predefined filtering value to ColumnA, for example, it will load all the data (because the placeholder is not defined in the Placeholders tab above the table). Then, when you add the shortcode like:
[wpdatatable id=1 var1=150] it will filter the table per columnA with the value of "150".
I hope this helps, but we can recommend these services for customization:
I’m missing something here, and the documentation doesn’t seem to explain it. I’m using a PHP Serialized Array as my data source, so I’m looking to have the variable passed to the input file path/url, as in my example. In other words – I need that placeholder to be passed to the “Input file path or URL”. What I’m finding is that the default value (from the Placeholders tab) is getting passed. But the intended override value (via the shortcode) is not getting passed.
So the system clearly supports passing the placeholder through the URL. But it is only passing the default value – not the value I’m setting in the shortcode. I’m pretty sure this is a bug.
You can use a hook for dynamic placeholders (place it in functions.php of your theme, or your child theme):
function updateVAR1($tableID){
global $wdtVar1;
//check is set GET parametar value_x
if(isset($_GET['value_x'])){
//get value from form field
$wdtVar1 = $_GET['value_x'];
}
}
add_action('wpdatatables_before_get_table_metadata', 'updateVAR1');
Brian - I have been trying to do the exact same thing but have not been successful. I use one table to get the clientID & create the url. It is correct & I can pull out the variable value. However the 2nd table does not filter. How is your table set up. Do you have a placeholder? Or a Predefined value? Or a shortcode with var1 = 1?
I'm using a PHP Serialized Array as my data source. So per the Aug 31 update from Aleksandar, I added an action hook that get's my value from the URL ($_GET) and sets it to Var1. I can then reference that var in my php code.
I'm trying to use placeholders in a datatable based on a PHP serialized array. My input URL is something like:
https://mydomain.com/path?id=%VAR1%
And I'm calling the shortcode in PHP per the documentation with:
I know the correct $id value is getting pulled into the shortcode, but the datatable only ever outputs using the default value.
Hi Brian
Thank you for reaching out to us.
With the plugin's builtin features you can add filters trought the URL
https://wpdatatables.com/faqmd/use-url-parameters-filtering/
or you can add a filter through the shortcode if you assign one of our placeholders to column settings/filters/predefined filtering value.
If you add %VAR1% as a predefined filtering value to ColumnA, for example, it will load all the data (because the placeholder is not defined in the Placeholders tab above the table). Then, when you add the shortcode like:
[wpdatatable id=1 var1=150] it will filter the table per columnA with the value of "150".
I hope this helps, but we can recommend these services for customization:
https://codeable.io/?ref=l1TW1
https://wpkraken.io/?tms-plugins
I’m missing something here, and the documentation doesn’t seem to explain it. I’m using a PHP Serialized Array as my data source, so I’m looking to have the variable passed to the input file path/url, as in my example. In other words – I need that placeholder to be passed to the “Input file path or URL”. What I’m finding is that the default value (from the Placeholders tab) is getting passed. But the intended override value (via the shortcode) is not getting passed.
So the system clearly supports passing the placeholder through the URL. But it is only passing the default value – not the value I’m setting in the shortcode. I’m pretty sure this is a bug.
Brian
Hey Brian.
Supposedly, your URL is https://yourwebsite.com/?value_x=123
You can use a hook for dynamic placeholders (place it in functions.php of your theme, or your child theme):
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 worked -- thank you.
You're welcome Brian, glad I could help.
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
Brian - I have been trying to do the exact same thing but have not been successful. I use one table to get the clientID & create the url. It is correct & I can pull out the variable value. However the 2nd table does not filter. How is your table set up. Do you have a placeholder? Or a Predefined value? Or a shortcode with var1 = 1?
John --
I'm using a PHP Serialized Array as my data source. So per the Aug 31 update from Aleksandar, I added an action hook that get's my value from the URL ($_GET) and sets it to Var1. I can then reference that var in my php code.
Brian - Are you using it with a shortcode? If so, how? If not, how do you use it?