I'm trying to edit the value of each cell in a hyperlink column to add the correct link dynamically (which is different depending on the cell value and table ID). The wpdatatables_filter_link_cell filter looked promising, but it doesn't pass the table ID, which I need. Is there any filter I could use which will pass the table ID and allow the return of the value of each cell in a hyperlink column?
It is a good point and we will see how to pass the table ID to the column-related hooks for future versions to simplify the future customizations.
For now unfortunately there's no way to do this, the only workaround we can think of is to include some unique placeholder in the cell itself, and then search for it in the wpdatatables_filter_link_cell hook, i.e.,
to each cell in the table where you want to adjust the content dynamically add something like %%REPLACEME%%
then in the wpdatatables_filter_link_cell hook you can look for this placeholder and replace it with what you need like:
How would you suggest adding the %%REPLACEME%% text to the cell? Since it is a URL link cell, the 'Display Text Before' and 'Display Text After' options do not seem to work.
I am currently using a CONCAT modifier in the query itself, which correctly adds the variable to the original cell value. I then have a wpdatatables_filter_link_cell hook to make the table-dependent edit. However, returning a value using either this notation: http://wpdatatables.com||Check out wpDataTables, or an html-style link (a href), I get a JSON error. What is the proper format for the return value of a wpdatatables_filter_link_cell hook?
Hi,
I'm trying to edit the value of each cell in a hyperlink column to add the correct link dynamically (which is different depending on the cell value and table ID). The wpdatatables_filter_link_cell filter looked promising, but it doesn't pass the table ID, which I need. Is there any filter I could use which will pass the table ID and allow the return of the value of each cell in a hyperlink column?
Thanks!
Hi Carl,
Thank you for your purchase,
It is a good point and we will see how to pass the table ID to the column-related hooks for future versions to simplify the future customizations.
For now unfortunately there's no way to do this, the only workaround we can think of is to include some unique placeholder in the cell itself, and then search for it in the wpdatatables_filter_link_cell hook, i.e.,
to each cell in the table where you want to adjust the content dynamically add something like %%REPLACEME%%
then in the wpdatatables_filter_link_cell hook you can look for this placeholder and replace it with what you need like:
Hope this helps.
Kind Regards,
Miloš Jovanović
[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
Thanks for the reply.
How would you suggest adding the %%REPLACEME%% text to the cell? Since it is a URL link cell, the 'Display Text Before' and 'Display Text After' options do not seem to work.
I am currently using a CONCAT modifier in the query itself, which correctly adds the variable to the original cell value. I then have a wpdatatables_filter_link_cell hook to make the table-dependent edit. However, returning a value using either this notation: http://wpdatatables.com||Check out wpDataTables, or an html-style link (a href), I get a JSON error. What is the proper format for the return value of a wpdatatables_filter_link_cell hook?
Thanks,
Carl
Never mind, there was an error elsewhere causing the JSON issue. I should be able to get this to work now, thanks.