Hi,
I'm new to nuBuilderpro and have been struggling with the placement of a button on a subform grid to navigate to the associated record form.
The database structure I have is:
table_1 -(1)--(M)-> table_2 -(1)--(M)-> table_3
My first form shows table_1 records with a subform from table_2. I want to add a button to the table_2 subform to navigate to a form that shows records from table_2 with a subform from table_3. The individual forms work as expected.
When I place a button on the table_2 subform it appears that the "#SUBFORM_RECORD_ID#" hash variable is not expanded in the "Record ID" field of the button. I have a "display" column that does expand the hash variable correctly and will display the count of the associated records in table_3. If I hardcode the record id of one of the sub records then the button works as expected, but every row gives the same sub records.
I've also noticed that the title of the button is only placed on the first button in the subform.
Is there a better way to achieve what I want?
Thanks,
Cliff
Welcome to the nuBuilder forums!
Please register and login to view forums and other content only available to registered users.
Please register and login to view forums and other content only available to registered users.
Navigating from a subform row to the associated record
-
- Posts: 2
- Joined: Tue Apr 04, 2017 11:16 am
-
- Site Admin
- Posts: 2786
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
- Been thanked: 3 times
Re: Navigating from a subform row to the associated record
Cliff,
I know this has been asked a few times, have you looked though the forum for answers?
Steven
I know this has been asked a few times, have you looked though the forum for answers?
Steven
-
- Posts: 2
- Joined: Tue Apr 04, 2017 11:16 am
Re: Navigating from a subform row to the associated record
Hi Steven,
Thanks for the nudge to look for an answer in the forum. I was only able to find a single thread that addressed what I was looking for:
http://forums.nubuilder.cloud/viewtopic.php?f=13&t=8521
However, when I tried this approach with my application it didn't work. Both nuRowPrefix(this) and nuRowNumber(this) returned undefined.
After looking at the source of the generated pages I worked out that the code bound to my button on the subform should contain:
and the function in the containing form should be:
This works as expected.
I've now removed the button from the subform, as it annoyingly only puts the title on the first button, and put an onclick handler on all of the fields in the subform which takes me to the related edit screen. My next task is to work out how to update the parent form after I return from editing the record in the pop-up form. Any suggestions welcome
Thanks for the nudge to look for an answer in the forum. I was only able to find a single thread that addressed what I was looking for:
http://forums.nubuilder.cloud/viewtopic.php?f=13&t=8521
However, when I tried this approach with my application it didn't work. Both nuRowPrefix(this) and nuRowNumber(this) returned undefined.
After looking at the source of the generated pages I worked out that the code bound to my button on the subform should contain:
Code: Select all
edit_row(this);
Code: Select all
function edit_row(btn){
var id = $('#' + nuRowPrefix(btn) + '_nuPrimaryKey').val();
nuOpenFormInFrame('58e22be7f0e9b20', id);
}
I've now removed the button from the subform, as it annoyingly only puts the title on the first button, and put an onclick handler on all of the fields in the subform which takes me to the related edit screen. My next task is to work out how to update the parent form after I return from editing the record in the pop-up form. Any suggestions welcome
-
- Site Admin
- Posts: 2786
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
- Been thanked: 3 times
Re: Navigating from a subform row to the associated record
cpenton,
I'm glad you had a look.
But this could be the thread, people coming after you may find helpful.
But to answer your last question you'll need to reload the page (nuReloadForm()).
Steven
I'm glad you had a look.
But this could be the thread, people coming after you may find helpful.
But to answer your last question you'll need to reload the page (nuReloadForm()).
Steven