Subject: Assistance Needed: Filtering wpDataTables Using Date, User Role, and User ID
Dear wpDataTables Support Team,
We have been working on implementing dynamic filtering for a table in wpDataTables, but we’ve encountered significant challenges. Here's a summary of our requirements and the issues we’re facing:
Setup Details:
The table in question is based on an SQL query.
The table is displayed using wpDataTables (ID: 7).
We need to filter the data dynamically using:
A date range (start_date and end_date).
The logged-in user’s role.
The logged-in user’s ID.
What We’ve Tried:
Using the URL parameters approach (e.g., adding ?start_date=YYYY-MM-DD&end_date=YYYY-MM-DD to filter).
While this partially works for simple filters, it’s not integrating well with the dynamic date range and user-specific parameters.
JavaScript for frontend filtering.
We tried applying filters via JavaScript by targeting the wpDataTable instance, but it didn’t seem to trigger or reload the filtered data as expected.
Hook-based server-side filtering.
We attempted using hooks such as wpdatatables_filter_data_before_display, but there were inconsistencies in passing dynamic data like user role or ID, especially for date ranges selected on the frontend.
Current Situation:
The table renders correctly, but:
The dynamic date range filter doesn’t work as expected.
User role and ID-based filtering are not applied consistently.
We’re unsure of the best method to implement a robust solution that combines these three filtering parameters.
Our Goal:
We need a clear and efficient way to:
Dynamically filter the table based on a date range selected on the frontend (via dropdown or date picker).
Apply server-side filters to ensure that data is displayed according to the logged-in user’s role and user ID.
Combine these filters seamlessly so the table updates correctly without requiring a page reload.
Could you please guide us on how to achieve this? If there’s a recommended method, example code, or best practice for such scenarios, we would appreciate your help.
Subject: Assistance Needed: Filtering wpDataTables Using Date, User Role, and User ID
Dear wpDataTables Support Team,
We have been working on implementing dynamic filtering for a table in wpDataTables, but we’ve encountered significant challenges. Here's a summary of our requirements and the issues we’re facing:
Setup Details:
What We’ve Tried:
Current Situation: The table renders correctly, but:
Our Goal: We need a clear and efficient way to:
Could you please guide us on how to achieve this? If there’s a recommended method, example code, or best practice for such scenarios, we would appreciate your help.
Thank you for your assistance!
Best regards, Mr Jim