Table of Contents
3.2.3 Add a button to table view
Since version 2019/11 you will be able to add buttons executing custom code to every row in table view.
- Create an empty file
TABLENAME-tv.jsin yourhooks-folder
ReplaceTABLENAMEby the exact name of your table.
If your table ispatients, the filename has to bepatients-tv.js.
Pay attention to the uppercase and lowercase letters. - Insert the following code
- Save the file and
- Reload the table view in the browser
jQuery(function () {
let tv = AppGiniHelper.TV;
let tablename = tv.getTableName();
let href = tablename + "_view.php?SelectedID=%ID%";
tv.addLink(href, "search", "Open");
});
File: hooks/TABLENAME-tv.js
You will see the new button next to the default checkbox. On click the related detail view opens up.

Please note that we are using the placeholder %ID% in our link which will be replaced by the record's primary key at runtime.

4. Next steps
5. Troubleshooting
If this is not working as expected, check the Troubleshooting guide:
