Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Open to specific record in subform

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
treed
Posts: 205
Joined: Mon May 18, 2020 12:02 am
Been thanked: 2 times
Contact:

Open to specific record in subform

Unread post 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?
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Open to specific record in subform

Unread post 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?
You do not have the required permissions to view the files attached to this post.
treed
Posts: 205
Joined: Mon May 18, 2020 12:02 am
Been thanked: 2 times
Contact:

Re: Open to specific record in subform

Unread post by treed »

The browse record clicked on will have the primary key available.
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Open to specific record in subform

Unread post by kev1n »

Sure. But about the record of the subform?
treed
Posts: 205
Joined: Mon May 18, 2020 12:02 am
Been thanked: 2 times
Contact:

Re: Open to specific record in subform

Unread post by treed »

The record in the subform has the same PK as the record clicked on in the ToDo list browse window.
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Open to specific record in subform

Unread post by kev1n »

I think I answered your question already 2 years ago: viewtopic.php?p=25275#p25275
Post Reply