Welcome to the nuBuilder Forums!

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

New row in subform

Questions related to using nuBuilder Forte.
Post Reply
johan
Posts: 399
Joined: Sun Feb 27, 2011 11:16 am
Location: Belgium
Been thanked: 3 times

New row in subform

Unread post by johan »

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
Janusz
nuBuilder Team
Posts: 506
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 8 times
Been thanked: 18 times

Re: New row in subform

Unread post by Janusz »

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');
If you like nuBuilder, please leave a review on SourceForge
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

Re: New row in subform

Unread post by kev1n »

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
You do not have the required permissions to view the files attached to this post.
johan
Posts: 399
Joined: Sun Feb 27, 2011 11:16 am
Location: Belgium
Been thanked: 3 times

Re: New row in subform

Unread post by johan »

Works perfect, thanks Kevin and Janusz
Johan
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

Re: New row in subform

Unread post by kev1n »

You're welcome!
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: New row in subform

Unread post by admin »

.
Post Reply