Skip to content

Lookup Button Modal

Version

Since 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 toLookupButtonModal() (or toLookupButton()) converts those links into buttons opening the detail view of the referred record in a modal dialog.

Convert into button, opening modal dialog

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

TV with lookup button modal

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