Skip to content

Lookup Button

Version

2022/03/14

By default, clicking any link in a table view cell opens the detail view of that record.

Default

Even if this is a lookup field referencing a different table, the link opens the detail view of the current table, not the detail view of the lookup table.

Using toLookupButton() (or toLookupButtonModal) converts those links into buttons opening the detail view of the referred record in the same page.

Convert into button, opening in same page

1
2
3
4
// file: hooks/contacts
jQuery(document).ready(function() {
    AppGiniHelper.TV.toLookupButton("partner_id", "partners");
});

TV with lookup button


Example

Table: partners

Column Info
id Primary Key
name Text Column

Table: contacts

Column Info
id Primary Key
name Text Column
partner_id Lookup to partners

After modification

The default link to contacts-detail-view has been replaced by a button opening partners-detail-view.

See also