

// file: hooks/patients-tv.js jQuery(function () { var tv = new AppGiniTableView(); tv.addButton(function (id) { alert("User clicked #" + id); }, "flash", "My function"); // "flash" is the name of the glyphicon // "My function" is the button text });
Tipp
Instead of executing Javascript function you can also add links. See here.
Syntax
new AppGiniTableView().addButton(callback, icon, text, variation);
Parameters
callback
javascript function with id-parameter, egfunction (id) { /* your code here */ }
icon
optional, string, eg. "cog", see also Glypgiconstext
optional, string, Button Text, eg. "Open"variation
optional, Variation, e.g. Variation.danger
Please note
The .addLink()
method (see here) has a prompt parameter which, if set, automatically displays a confirmation prompt.
This .addButton()
method does not have a prompt parameter. But you can show the alert or confirmation prompt in your code - if required.
- Add button named "My function"
with icon "glyphicon-flash" - On click
- get last name
- get first name
- concatenate a text
- show alert
// file: hooks/patients-tv.js jQuery(function () { var tv = new AppGiniTableView(); tv.addButton(function (id) { var last_name = tv.getValue(id, "last_name"); var first_name = tv.getValue(id, "first_name"); var text = "Clicked item #" + id + ": " + last_name + ", " + first_name; customAlert(text); }, "flash", "My function"); });

See also
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.
If something is not working as expected with your code, please post your detailed bugreport in the forum and make use of the free community support. This here is website feedback, only.