I am trying to do exactly the same and cannot find any documentation or examples on how to do it. I believe it can be achieved using the action hook wpdatatables_before_get_table_metadata but there are no working examples of this anywhere.
In my case, I have a session variable that I want to assign to %VAR1%. It should be so simple.
This falls under custom work. You would need to create a script (JS) that would send data through ajax after every submission to a custom action in back-end; render the shortcode (table, that is) and replace it with an existing one on the page.
That's one possible solution, but all this is custom work which is not included in the provided support for the plugin.
Hi
I use the %%VAR1%% placeholder in an SQL query based table.
I have an HTML input field.
I would like the table to load with VAR1="content of the field" after I press a submit button. (I am familier with PHP and JS)
Is there any way to pass a vlaue to the palceholder that is not pre-writen in the shortcode?
Thanks!
Erez
I am trying to do exactly the same and cannot find any documentation or examples on how to do it. I believe it can be achieved using the action hook wpdatatables_before_get_table_metadata but there are no working examples of this anywhere.
In my case, I have a session variable that I want to assign to %VAR1%. It should be so simple.
Steve
Erez
You can do this in php ...
function set_table_var ($tableId)
{
global $wdtVar1;
$wdtVar1 = <your value>
}
add_action('wpdatatables_before_get_table_metadata','set_table_var');
Steve
Many thanks!!
Looks very good.
I will give it a try and feedback on the result
Hi
It works great! Thanks!
I used this HTML
With this PHP at the Header
The test page is: https://www.machiningdoctor.com/table-with-form-test/
You can put P,M or K in the input to see the table changing.
The only downside is that the page reloads for each input.
Can I do the same with AJAX and only change the table conent on the bottom while the input stays on the top?
Many Thanks!!!
Erez
Hello Erez and Steve
Great to see you guys were able to resolve this on your own! I'm sure this ticket will come in handy for others who have similar requests.
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,
The credit goes to Steve!
However, could you address my followup question regarding Ajax?
Thanks!
Hi again Erez
This falls under custom work. You would need to create a script (JS) that would send data through ajax after every submission to a custom action in back-end; render the shortcode (table, that is) and replace it with an existing one on the page.
That's one possible solution, but all this is custom work which is not included in the provided support for the plugin.
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