How to make data items clickable?
-
I have the WPDA 3.0.2 working on a current version of WordPress, using a view that includes two unique hyperlinks, of which one is “local” to the WP $HOME and the other off-site.
Both show as expected when the publication type is MODAL. I would like to have them be ACTIVE/clickable.
Is that possible?
TIA.
Dave
-
Hi Dave,
You can do this, but you need to define these columns as hyperlinks in your table settings. You will also need to format these columns correctly. There is a topic in which this issue was discussed, you can find it here:
https://www.ads-software.com/support/topic/calculated-field-column-in-db-list/Can you add your view definition? Maybe I can help.
Thanks,
PeterHi Peter,
Here is the core of my view.
Fields that I would like to have as active hyperlinks are:
c_songtitles.hymnary_org_url
and
c_mtracks.url
– – –
select
c_songtitles
.st_id
ASst_id
,
c_songtitles
.st_title
ASst_title
,
c_songtitles
.st_genre
ASst_genre
,
c_songtitles
.music_key
ASmusic_key
,
c_songtitles
.hymnary_org_url
AShymnary_org_url
,
c_song_genres
.id
ASid
,
c_song_genres
.genre
ASgenre
,
midi_sequencers
.ms_id
ASms_id
,
midi_sequencers
.ms_name
ASms_name
,
c_mtracks
.mst_id
ASmst_id
,
c_mtracks
.sequencer_id
ASsequencer_id
,
c_mtracks
.url
ASurl
,
midi_voicing
.mv_id
ASmv_id
,
midi_instrumentation
.mi_id
ASmi_id
,
midi_voicing
.mv_desc
ASmv_desc
,
midi_instrumentation
.mi_desc
ASmi_desc
from (((((c_songtitles
joinc_song_genres
)
joinmidi_sequencers
)
joinc_mtracks
)
joinmidi_voicing
)
joinmidi_instrumentation
)
where
(
(c_mtracks
.mst_id
=c_songtitles
.st_id
) and
(c_mtracks
.sequencer_id
=midi_sequencers
.ms_id
) and
(c_song_genres
.id
=c_songtitles
.st_genre
) and
(c_mtracks
.voicing
=midi_voicing
.mv_id
) and
(c_mtracks
.instrumentation
=midi_instrumentation
.mi_id
)
)
order by
c_songtitles
.st_title
– – – – –
TIA.
Dave- This reply was modified 4 years, 8 months ago by Dave.
Hi Dave,
There are two ways to handle this.
(1) Turn your column into a hyperlink column
To do this you need to add some json to that column. The plugin needs this format:
{ "label" : "your-label", "url" : "your-url", "target" : "_blank" }
After that you need to tell the plugin to handle the column as a hyperlink in table settings:
– Go to the Data Explorer
– Click on the Manage of your table
– Click Settings
– Click Column Settings
– Select hyperlink as the column type
– Save your settingsYou can add json to your column like this:
concat('{"label":"',first_name,'","url":"https://wordpress.local/wp-admin/admin.php?page=wpda&table_name=authors&action=listtable&wpda_s=',first_name,'","target":""}') as url
If you tell me what your url should look like, I can help!
(2) Wait a few days and use the new feature “dynamic hyperlink”s”
This feature allows you to add hyperlinks to your table or view and allows the substitution of column values in your url. Much easier… ??
I really finished it just this morning! I have to fix a few minor thing before I can put it online. But it won’t take more than just a few days.
Best regards,
PeterIt is becoming CLEARER, Peter!
But WHERE does the JSON get added to the column?
Thanks.
DaveHi Dave,
You can add it to your create view statement, like this:
SELECT column1, column2, concat('{"label":"',your-label,'","url":"your-url","target":""}') as url column3, FROM view_name;
Best regards,
PeterI don’t recognize what should be substituted in that concat string, except that “target” will likely be “_blank”.
Does label = the field name and url/your-url = the data?
Sorry to be so “dense between the ears”!
d.Hi Dave,
Maybe you can start to just add a hardcoded url column to your select and add dynamic data when it works.
Add this column to your view:
'{"label":"search","url":"https://www.google.com/","target":"_blank"}' as url
It is hardcode, so you can copy and paste it into your script file.After that:
– Start the Data Explorer
– Click on the Manage link of your view
– Click Settings
– Click Column Settings
– Select hyperlink for the new column url
– Save your settingsTest your view! And let me know if that works…
Best regards,
PeterOK!
Hard-coded URL works but the concat() string MUST have a “comma” at the end of the line.I’m guessing now that what you’re working on MIGHT provide the ability to replace the hard-coded URL with the actual data in a selected field?
I’m “all in” for something like that! And can wait until the “coronavirus” comes around and then I have to run because I’m 15 years past the youngest members of the high-risk group!
THANKS, Peter!
d.Hi Dave,
Don’t give up! You’re almost there… ??
With concat you can now add your own data to the json string. Please change the previous hardcoded url to this:
concat( '{"label":"search","url":"', c_songtitles.hymnary_org_url, '","target":"_blank"}') as url
Let me know if it works! ??
Best regards,
PeterPeter,
The explicit table.fieldname (c_songtitles.hymnary_org_url) does NOT work;
HOWEVER, the ALIAS works PERFECTLY!What a dream come true!
I’ve been fooling with “custom fields” and FAILING.I think the appropriate expression (perhaps outdated) is: YOU da bomb, Peter!
THANKS!
d.Great! ??
I’ll release the next version this week. I’ll let you know when it is available. You might consider to use the new dynamic hyperlink feature anyway.
Best regards,
PeterHi Dave,
Just wanted to let you know that version 3.0.3 supports dynamic hyperlinks. You’ll just need to update the plugin to make it available.
You can find more info about the new feature here:
https://wpdataaccess.com/2020/03/22/dynamic-hyperlinks/Best regards,
Peter
- The topic ‘How to make data items clickable?’ is closed to new replies.