Page 1 of 1
Open to specific record in subform
Posted: Thu Feb 09, 2023 11:40 pm
by treed
I have a To Do list that's a browse screen. Right now when the user selects a record, they are taken to the Organization edit screen. What I want the system to do is open the second tab on the Organization screen and go to the record in the subform on that tab that matches the record clicked on in the To Do list.
I see the start to the solution is to use the nuSelectBrowse(e) function in the To Do list to open the Organization edit form, but I don't know how to open the second tab or go to the needed record in the subform. Suggestions?
Re: Open to specific record in subform
Posted: Sat Feb 11, 2023 10:15 am
by kev1n
To open a specific tab when the user selects a record in a Browse Screen, declare a function nuSelectBrowse() and set a window variable (e.g. openTab) with the title of the tab to open.
browse.png
Code: Select all
function nuSelectBrowse(e){
window.openTab = 'TabX'; // <---- Title of the tab to be opened.
const recordId = $('#' + e.target.id).attr('data-nu-primary-key');
nuForm(nuGetProperty('form_id'), recordId, '', '', '2');
}
edit.png
When the edit form is opened, retrieve the tab title and select that tab.
Code: Select all
if (window.openTab) {
nuSelectTabByTitle(window.openTab);
window.openTab = undefined;
}
and go to the record in the subform on that tab that matches the record clicked on in the To Do lis
How to identify that record?
Re: Open to specific record in subform
Posted: Mon Feb 13, 2023 8:38 pm
by treed
The browse record clicked on will have the primary key available.
Re: Open to specific record in subform
Posted: Tue Feb 14, 2023 7:24 am
by kev1n
Sure. But about the record of the subform?
Re: Open to specific record in subform
Posted: Tue Feb 14, 2023 8:03 pm
by treed
The record in the subform has the same PK as the record clicked on in the ToDo list browse window.
Re: Open to specific record in subform
Posted: Wed Feb 15, 2023 6:53 pm
by kev1n
I think I answered your question already 2 years ago:
viewtopic.php?p=25275#p25275