I am currently working with several tables that retrieve data from SQL queries, and I need to add an extra column at the end of each row. This column should allow me to insert custom actions, such as buttons linking to a URL that incorporates data from the respective row.
For example: <a href="some_url?id=$rowID">action</a>
I came across the wpdatatables_after_row action, which seems like it could be very useful for this purpose. However, I am facing two challenges:
1. The action returns the table ID and the rowIndex, but not the rowID, which I need to use as a parameter in my AJAX call.
2. The action is triggered after the closing </tr> tag, so I am unable to add an additional <td> directly.
Given these challenges, I would appreciate your guidance on the following:
- Is there a workaround to address these issues?
- Alternatively, do you recommend another approach to implement this functionality?
Thank you very much for your time and assistance. I look forward to your advice.
1. In regards to adding a Custom column to an SQL Query based Table :
Sorry to disappoint you, but at this time, we don't have any built-in solution to achieve this.
We can only add a new column which does not exist in the SQL database in our Manual Tables because the Manual table creates a 'stand alone' SQL table with its own set of columns + rows in your Database;
on the other hand, our SQL Query tables can only call data from existing columns.
You can suggest it to our developers, though - they will do their best to make a solution in the future.
to see if someone may be already suggested this feature. If you can't see it, feel free to add your suggestion there, and as more people vote, the feature will move higher on the priority list.
You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;
and our newsletter, so you're informed about new features, bug fixes, freebies, etc.
If you have coding skills and wish to try to make a custom solution now,
We also added this new developer's handbook, which can allow users with coding skills to make custom add-ons.
Our developers will keep adding more custom hooks/examples there over time.
Please be advised that custom solutions with hooks are not included in our support.
You can also research resources such as Stack Overflow to see if any other user perhaps found a workaround.
( We do like to give examples for certain solutions, but for this use-case, we, unfortunately, don't have anything yet)
2. In regards to that custom hook use-case you tried, I will ask our developers.
They will do their best to try to advise, but I can't guarantee anything, because our Support does not cover custom solutions with hooks so we are very limited on that subject on what we can help or advise with.
If they tried something like that, they will advise based on previous experience, etc.
As soon as they take a closer look, we will report back and going to let you know if they need any additional details from your end.
thank you for your reply and the resources. I have already checked the most of them. Probably I will do a custom solution with jQuery (append a <td> in each <tr> of the table). Just stating it as an idea for future visitors :)
Dear Sir/Madame,
I am currently working with several tables that retrieve data from SQL queries, and I need to add an extra column at the end of each row. This column should allow me to insert custom actions, such as buttons linking to a URL that incorporates data from the respective row.
For example: <a href="some_url?id=$rowID">action</a>
I came across the wpdatatables_after_row action, which seems like it could be very useful for this purpose. However, I am facing two challenges:
1. The action returns the table ID and the rowIndex, but not the rowID, which I need to use as a parameter in my AJAX call.
2. The action is triggered after the closing </tr> tag, so I am unable to add an additional <td> directly.
Given these challenges, I would appreciate your guidance on the following:
- Is there a workaround to address these issues?
- Alternatively, do you recommend another approach to implement this functionality?
Thank you very much for your time and assistance. I look forward to your advice.
Best regards,
Angelos Synadakis
Hi Angelos,
1. In regards to adding a Custom column to an SQL Query based Table :
Sorry to disappoint you, but at this time, we don't have any built-in solution to achieve this.
We can only add a new column which does not exist in the SQL database in our Manual Tables because the Manual table creates a 'stand alone' SQL table with its own set of columns + rows in your Database;
on the other hand, our SQL Query tables can only call data from existing columns.
You can suggest it to our developers, though - they will do their best to make a solution in the future.
Please feel free to search on our suggestions page,
to see if someone may be already suggested this feature. If you can't see it, feel free to add your suggestion there, and as more people vote, the feature will move higher on the priority list.
You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;
and our newsletter, so you're informed about new features, bug fixes, freebies, etc.
If you have coding skills and wish to try to make a custom solution now,
you can check out our available hooks for Developers on this documentation and see if you can find any hook that might help.
We also added this new developer's handbook, which can allow users with coding skills to make custom add-ons.
Our developers will keep adding more custom hooks/examples there over time.
Please be advised that custom solutions with hooks are not included in our support.
You can also research resources such as Stack Overflow to see if any other user perhaps found a workaround.
( We do like to give examples for certain solutions, but for this use-case, we, unfortunately, don't have anything yet)
2. In regards to that custom hook use-case you tried, I will ask our developers.
They will do their best to try to advise, but I can't guarantee anything, because our Support does not cover custom solutions with hooks so we are very limited on that subject on what we can help or advise with.
If they tried something like that, they will advise based on previous experience, etc.
As soon as they take a closer look, we will report back and going to let you know if they need any additional details from your end.
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
Hi Miloš,
thank you for your reply and the resources. I have already checked the most of them. Probably I will do a custom solution with jQuery (append a <td> in each <tr> of the table). Just stating it as an idea for future visitors :)
Thanks again.
Best,
Hi Angelos,
Thank you for sharing this custom idea, it will be very useful for other users with coding knowledge, at least as a starting point.
I will share this with our developers, too, so we might add an example to our "Developer's handbook" for that scenario soon.
If they find any easier/better solution in the meantime, we will report back to share it with you.
Thanks again.
If anything else comes up, please don't hesitate to open new tickets.
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