Page 1 of 1
New row in subform
Posted: Fri Jan 03, 2020 8:20 am
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
Re: New row in subform
Posted: Tue Jan 07, 2020 11:19 pm
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');
Re: New row in subform
Posted: Wed Jan 08, 2020 8:31 pm
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
Re: New row in subform
Posted: Thu Jan 09, 2020 7:57 pm
by johan
Works perfect, thanks Kevin and Janusz
Johan
Re: New row in subform
Posted: Fri Jan 10, 2020 5:40 am
by kev1n
You're welcome!
Re: New row in subform
Posted: Sat Jan 11, 2020 10:31 pm
by admin
.