Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Sequential Numbering Subform Grid Rows Topic is solved
Sequential Numbering Subform Grid Rows
With a grid subform is there a way to populate new rows with a sequential number starting from 1 as they are added? Or if it would be easier, set the value after a selection is made?
Re: Sequential Numbering Subform Grid Rows
Hi treed,
Add this event to your subform...
And put this js on the Form...
item_sf = subform name
seq_id = id for subform autoid
Steven
Add this event to your subform...
And put this js on the Form...
item_sf = subform name
seq_id = id for subform autoid
Code: Select all
function addAuto(){
var a = nuSubformObject('item_sf').rows.length;
var i = '#item_sf' + nuPad3(nuSubformObject('item_sf').rows.length - 1) + 'seq_id';
$(i).val(a).addClass('nuEdited');
}
Steven
You do not have the required permissions to view the files attached to this post.
A short post is a good post.
Re: Sequential Numbering Subform Grid Rows
Thanks Steven, Once I figured out that the subform name was the subform object name on the main form and not the subform itself, this code works.
However the way it works is that the first row is not numbered and the next row to be inserted is given the correct number. What I'd like to do is either set the value to 1 for the first row or just number the current row, which ever is easier. Any ideas?
However the way it works is that the first row is not numbered and the next row to be inserted is given the correct number. What I'd like to do is either set the value to 1 for the first row or just number the current row, which ever is easier. Any ideas?
Re: Sequential Numbering Subform Grid Rows
Ah figured it out. This now numbers the edited row.
Code: Select all
var a = nuSubformObject('BuildPac').rows.length - 1;
var i = '#BuildPac' + nuPad3(nuSubformObject('BuildPac').rows.length - 2) + 'OrdPacBoxNumb';
$(i).val(a).addClass('nuEdited');