New row in subform

Questions related to using nuBuilder Forte.

New row in subform

Postby johan » Fri Jan 03, 2020 4:50 pm

Hi
When I want to add a new row in a subforum it's in the bottom of the grid. This is not so userfriendly when there are many rows.
How to show new line in top? Or is there another sollution?
Johan
johan
 
Posts: 306
Joined: Sun Feb 27, 2011 7:46 pm
Location: Belgium

Re: New row in subform

Postby Janusz » Wed Jan 08, 2020 7:49 am

If you want to have the new line in the top you can sort the subform from the main form.
You can add to the JS on the main form the following.
(use your subform reference and column number -2nd parameter- which will be used for sorting)

Code: Select all
nuSortSubform("sub_FF_parts", "5", 'asc');
Janusz
 
Posts: 288
Joined: Fri Dec 28, 2018 10:11 pm
Location: Krakow, Poland

Re: New row in subform

Postby kev1n » Thu Jan 09, 2020 5:01 am

Or add a button which will when clicked set the focus on the first field of the last row in the subform .

Code: Select all
function subFormFocusLastRow(subFormId, fieldId) {
   var lastRow = nuSubformObject(subFormId).rows.length;
   lastRow = lastRow == 1 ? lastRow : lastRow-1;
   console.log(subFormId + nuPad3(lastRow) + fieldId);
   $('#' + subFormId + nuPad3(lastRow) + fieldId).focus();
}


focus.gif
focus.gif (724.11 KiB) Viewed 226 times
kev1n
 
Posts: 557
Joined: Mon Oct 15, 2018 2:13 am

Re: New row in subform

Postby johan » Fri Jan 10, 2020 4:27 am

Works perfect, thanks Kevin and Janusz
Johan
johan
 
Posts: 306
Joined: Sun Feb 27, 2011 7:46 pm
Location: Belgium

Re: New row in subform

Postby kev1n » Fri Jan 10, 2020 2:10 pm

You're welcome!
kev1n
 
Posts: 557
Joined: Mon Oct 15, 2018 2:13 am

Re: New row in subform

Postby admin » Sun Jan 12, 2020 7:01 am

.
admin
Site Admin
 
Posts: 3234
Joined: Mon Jun 15, 2009 9:53 am


Return to General



cron