Add Link (Table View)

// file: hooks/patients-tv.js

jQuery(function () {

  // please note the placeholder %ID%
  var url = "patients_view.php?SelectedID=%ID%";

  var tv = AppGiniHelper.TV;
  tv.addLink(url, "search", "Open");

  // tv.addLink(href, icon, text, variation, prompt)

});

Tipp
You can also add buttons executing a custom javascript function. See here.

.addLink(href, icon, text, variation, prompt)

Parameters

  • href Link address (url)
    string, eg. TABLENAME_view.php?SelectedID=%ID%
    Accepts placeholder %ID% which will be replaced by the record's primary key per row
  • icon
    optional, string, e.g. "cog", see also Glyphicons
  • text Button Text
    optional, e.g. "Edit"
  • variation
    optional, e.g. Variation.danger
  • prompt
    optional, string
    If defined, there will be a confirmation prompt before
// file: hooks/patients-tv.js

jQuery(function () {

  var tv = AppGiniHelper.TV;

  // get table name
  var tablename = tv.getTableName();

  // build link url
  // note the %ID% placeholder
  var url = tablename + "_view.php?SelectedID=%ID%";

  // add the link button
  // please note the text for the confirmation prompt
  tv.addLink(url, "search", "Open",Variation.warning, "Really?");
});

See also

Do you like it?