I have an admin page where the user can click a button to define time frame for data, e.g. "This Week", "Last Week", ...
Once clicked, I will calculate the start and stop dates, then pass them to another page (through the url) that has the wpDataTable where I am using placeholders in my query. I want to set the placeholders with the start and stop dates.
I know I can set a filter through the URL, but then the query isn't bound by a where clause, i.e. "where date between '%var1%' and '%var2%', so all rows are returned and then filtered. Correct? Just wondering what happens when a table has thousands of rows.
I'm not using server-side processing because I want to group by date.
All tables above 2.000 rows have server-side processing enabled automatically, so if your tables get bigger than that, that feature will turn itself on.
You can use the date range filter and change it through URL, by separating the start and the end date with a pipe ( | ). I just don't know if that's what you're looking for to achieve. Do you have a live example somewhere, so I can take a look and see how it works now?
Filters, Sorting and Search may not work properly with a query as complex as this one. wpDataTables' server has problems parsing this query, and that's why they don't work correctly in the plugin.
You can prepare a MySQL view (a stored query), which will return the data that you need, call it e.g. “view1” and then build a wpDataTable based on a simple query like “SELECT * FROM view1″.
The limitation here is that you wouldn't be able to edit that table, but my guess is that you can't do that now either, correct?
It works fine with placeholders in the Where clause. I just need to specify VAR1 and VAR2 before the page is rendered. Assume this is done through PHP or some other mechanism. Has anyone ever inquired about setting the values for placeholders dynamically?
Aleksandar is on vacation and I will help you out.
If you need to filter placeholders then you can use our hook for dynamic upsetting placeholders
function updatePlaceholders($tableID){
global $wdtVar1,$wdtVar2;
// here you can insert your logic for dynamic upsetting placeholders
// for testing purpose we insert dummy data test1 and test2
$wdtVar1 = 'test1';
$wdtVar2 = 'test2';
}
add_action('wpdatatables_before_get_table_metadata', 'updatePlaceholders');
Like this I believe you will get result like you need
If you have any other issue or question please open a new ticket, and we will help you out.
I’d like to ask you a favor. Would you mind taking a few minutes to write a review for us, please on this link?
Our free version is the only place where we can have proof for our hard work; your comments are beneficial for others to know what to expect when they’re looking for our plugin.
Thank you in advance. It means a lot to us, and I am looking forward to reading your comment.
I have an admin page where the user can click a button to define time frame for data, e.g. "This Week", "Last Week", ...
Once clicked, I will calculate the start and stop dates, then pass them to another page (through the url) that has the wpDataTable where I am using placeholders in my query. I want to set the placeholders with the start and stop dates.
I know I can set a filter through the URL, but then the query isn't bound by a where clause, i.e. "where date between '%var1%' and '%var2%', so all rows are returned and then filtered. Correct? Just wondering what happens when a table has thousands of rows.
I'm not using server-side processing because I want to group by date.
Any suggestions?
Hello Frank
Thank you for your purchase.
All tables above 2.000 rows have server-side processing enabled automatically, so if your tables get bigger than that, that feature will turn itself on.
You can use the date range filter and change it through URL, by separating the start and the end date with a pipe ( | ). I just don't know if that's what you're looking for to achieve. Do you have a live example somewhere, so I can take a look and see how it works now?
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 Frank
I'm glad to hear you're making progress.
Filters, Sorting and Search may not work properly with a query as complex as this one. wpDataTables' server has problems parsing this query, and that's why they don't work correctly in the plugin.
You can prepare a MySQL view (a stored query), which will return the data that you need, call it e.g. “view1” and then build a wpDataTable based on a simple query like “SELECT * FROM view1″.
The limitation here is that you wouldn't be able to edit that table, but my guess is that you can't do that now either, correct?
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
It works fine with placeholders in the Where clause. I just need to specify VAR1 and VAR2 before the page is rendered. Assume this is done through PHP or some other mechanism. Has anyone ever inquired about setting the values for placeholders dynamically?
Hello Frank,
Aleksandar is on vacation and I will help you out.
If you need to filter placeholders then you can use our hook for dynamic upsetting placeholders
Like this I believe you will get result like you need
Kind Regards,
Isidora Markovic
wpDataTables: FAQ | Facebook | Twitter | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Amelia demo sites | Docs
You can try our wpDataTables add-ons before purchase on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables
Exactly what I was looking for. Thanks! I'll give it a try. May have additional questions. :)
If I want to pass the values through the URL, does the function now look like this...
Also, if I don't pass the table ID, then %VAR1% and %VAR2% is set the same for all tables on the page that use those placeholders. Correct?
Yes Frenk
That is correct.
If you don't pass table ID it will be applied on all tables that use placeholders not just on that page.
Kind Regards,
Isidora Markovic
wpDataTables: FAQ | Facebook | Twitter | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Amelia demo sites | Docs
You can try our wpDataTables add-ons before purchase on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables
Finally, does that function get added to the function.php file?
Hi Frank,
Yes you need to insert that hook in functions.php of your theme.
Kind Regards,
Isidora Markovic
wpDataTables: FAQ | Facebook | Twitter | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Amelia demo sites | Docs
You can try our wpDataTables add-ons before purchase on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables
Thank you.
Hi Frank,
You are welcome.
If you have any other issue or question please open a new ticket, and we will help you out.
I’d like to ask you a favor. Would you mind taking a few minutes to write a review for us, please on this link?
Our free version is the only place where we can have proof for our hard work; your comments are beneficial for others to know what to expect when they’re looking for our plugin.
Thank you in advance. It means a lot to us, and I am looking forward to reading your comment.
Best regards.
Kind Regards,
Isidora Markovic
wpDataTables: FAQ | Facebook | Twitter | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Amelia demo sites | Docs
You can try our wpDataTables add-ons before purchase on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables
Will do. Thanks.