mathesar
mathesar copied to clipboard
Add functionality to the Record Selector to support selecting a list of hyperlinks instead of a list of buttons
Current behavior
- The Record Selector launches when
RecordSelectorController.acquireUserInput
is called. - Each row within the Record Selector acts like a button.
- When the user clicks on a row, the Promise returned from
acquireUserInput
resolves to the id of the record that the user selected.
Use case not met by the current behavior
- While
acquireUserInput
is good for getting a record id from the user (e.g. to save it in a cell value), in other contexts we'd like to use the Record Selector to navigate to a specific Record Page. For navigation, a hyperlink-row would be more appropriate than a button-row -- that way the user can open the Record Page link in a new tab.
Implementation
- Add a new property to
RecordSelectorController
calledrowType
which is'button' | 'hyperlink'
- Add a new method to
RecordSelectorController
callednavigateToRecordPage
. When called it setsthis.rowType
to'hyperlink'
. This function will be similar toacquireUserInput
except that it doesn't need to return a Promise. - When calling
acquireUserInput
, setthis.rowType
to'button'
. - Within some of the lower-level components, changes based on
rowType
to use hyperlinks for rows.