By the way, for just opening the row in Detail View, there is a shorthand function:
Code: Select all
// file: hooks/TABLENAME-tv.js
jQuery(document).ready(function() {
AppGiniHelper.tv.addButtonOpen();
});
.addButtonOpen()
renders a button in every row. Check the URL at the bottom of the page in the following screenshot:

- VoFb52iyVu.png (16.1 KiB) Viewed 3683 times
If you prefer a different icon or even text, you can pass those parameters:
Code: Select all
AppGiniHelper.tv.addButtonOpen("triangle-right", "Öffnen")

- chrome_Vy1381tZnk.png (6.38 KiB) Viewed 3683 times
I'm using this a lot. Actually, I am placing such code in a javascript function in
hooks/header-extras.php
. Having such functions in a central place means it will render such buttons in
every DV. I dont' have to place it in every single TABLENAME-dv.js.
Additional Links
Additionally, I'm often adding extra buttons for directly opening child-records of a record. This requires master-child relations, built based on lookups, obviously. In the following case there is a master-table
partners
, having
id
as primary key and mulitple child-tables (
contacts
,
calculations
,
machines
), having a lookup column named
partner_id
, each:
Code: Select all
$j(document).ready(function() {
var tv = AppGiniHelper.TV;
tv
.addButtonOpen()
.addLink("contacts_view.php?filterer_partner_id=%ID%", "user", "...")
.addLink("calculations_view.php?filterer_partner_id=%ID%", "align-left", "...")
.addLink("machines_view.php?filterer_partner_id=%ID%", "cog", "...");
});
As you can see in the code above, I'm just using the placeholder
%ID%
in every added link URL. This placeholder will be replaced by each row's specific primary key on load.

- chrome_LSGKWzK8Ov.png (7.16 KiB) Viewed 3683 times
---
Custom pages
You can also link to any other URL, for example to custom pages like this one:
Code: Select all
AppGiniHelper.TV
.unlink()
.addButtonOpen()
.addLink("calculations_tree.php?SelectedID=%ID%", "align-left", "Struktur");
It is the same principle.

- chrome_FC08ZGNkgl.png (9.06 KiB) Viewed 3683 times