adding a url to details display item

72 views
Skip to first unread message

tom wible

unread,
Jul 13, 2021, 10:13:24 AM7/13/21
to Xataface
i have a table of artworks, and the details page displays the artist's name via the fields.ini directives:
[artistID]
widget:type = select
vocabulary = selectArtist
column:label = "artist"

and valuelist.ini directives:
[selectArtist]
__sql__ = "select lalo_artists.artistID, CONCAT(lalo_artists.firstNAME, ' ', lalo_artists.lastNAME) as artistList
  FROM lalo_artists
  order by lalo_artists.lastNAME, lalo_artists.firstNAME;"
 
what i would like to do is make the artist name a link to that artist's record in the artist table...i'm sure it's possible, i just haven't found the sekrit incantation;-)

can i buy a clue, pls?-)

Steve Hannah

unread,
Jul 13, 2021, 10:33:55 AM7/13/21
to xata...@googlegroups.com
Use fieldname__renderCell() to customize the cell content for this field in list view, and include a <a href="..."> tag.


--
You received this message because you are subscribed to the Google Groups "Xataface" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xataface+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xataface/ba7bdec4-7ca4-4054-9982-f051e2f5661an%40googlegroups.com.


--
Steve Hannah
Web Lite Solutions Corp.

tom wible

unread,
Jul 13, 2021, 12:57:34 PM7/13/21
to Xataface
ah, exxxcellent, thanx:-) ur definitive guide only mentions ...renderCell() in relation to the needed noLinkFromListView directive, and ur old howto page doesn't mention ...renderCell()-:

and will that apply to the detail view as well as list? 
      label="artist" 
doesn't change the detail view as 
     column:label = "artist"
does for the list view...
 

tom wible

unread,
Jul 13, 2021, 1:00:16 PM7/13/21
to Xataface
o-wait, old howto page does mention  ...renderCell, just not renderCell()-;

tom wible

unread,
Jul 13, 2021, 1:06:46 PM7/13/21
to Xataface
and after rtfm, i c 

"If you want to change the way a field is rendered in both the list tab and the view tab it may be better to use the %fieldname%__display() method."

tom wible

unread,
Jul 13, 2021, 4:26:00 PM7/13/21
to Xataface
so i added this to my artworks.php (artistList is from the vocabulary = selectArtist):

    function artistID__display( &$record ){
       return '(<a href="/lalo_DB/index.php?-table=lalo_artists&artistID='
        . $record->strval('artistID'). '">' . $record->strval('artistList') . '</a>)'; 
    }

this to fields.ini:

[artistID]
widget:type = select
vocabulary = selectArtist
column:label = "artist"
label = "artist"
noLinkFromListView = 1

and on the details view:

ArtistID       (<a href="/lalo_DB/index.php?-table=lalo_artists&artistID=41"></a>)

note the field name is still artistID, not artist, but hey, it got the artistID right;-) 
but in the list view, all i get is a column of empty parens () containing but hey, the column name is artist;-)

replacing the __display() with __renderCell() results in the same non-link ArtistID in details view, but the list view's empty parens contain the correct link, so that's progress;-)

tom wible

unread,
Jul 13, 2021, 4:46:21 PM7/13/21
to Xataface
okeydokey, i've got the artworks list to make the artist name into the correct link, as explained in 

    function artistID__renderCell( &$record ){
       return '(<a href="/lalo_DB/index.php?-table=lalo_artists&artistID='
        . $record->strval('artistID'). '">name=' . $record->display('artistID') . '</a>)';
    }

but the view detail still only shows the name without link:-\

tom wible

unread,
Jul 14, 2021, 9:51:04 AM7/14/21
to Xataface
is there a way to set noLinkFromListView globally, so i don't have to turn off links for each field?

tom wible

unread,
May 2, 2023, 1:58:19 PM5/2/23
to Xataface
i'm still trying to add a url to a details item...where/how do i use these record_actions?

tom wible

unread,
May 2, 2023, 5:07:24 PM5/2/23
to Xataface
ok, i figured out [__global__] noLinkFromListView=1
and i found how to display a calculated on the details page
but my html is rendered as text, not a live link...is there __renderCell function for detail view as there is for list view?

tom wible

unread,
May 2, 2023, 5:37:27 PM5/2/23
to Xataface
ok, i found <calcfield>__htmlValue() in 
but that doesn't do anything 

tom wible

unread,
May 2, 2023, 6:24:26 PM5/2/23
to Xataface
ok figured it out...define the calc_val with field__calc_val() then reference it in function calc_val__htmlValue( )
 $record->val('calc_val');

nice! thanx, steve:-)
Reply all
Reply to author
Forward
0 new messages