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.js
in yourhooks
-folder
ReplaceTABLENAME
by 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:
Do you like it?
We can only get better if you give us constructive suggestions for improvement. Just voting "No" without giving reasons or suggestions is not helpful and cannot lead to changes.
If you have been searching for a completely different solution than the subject says, this article can not be and will not be helpful for you. In these cases you should consider not to vote.
This is website feedback, only. This voting is not a support form nor ticket system.