If you are working with a List Grid that uses some type of sequence field (for example,
SEQNO
, LINE_SEQ
, SORT_SEQ
), there
is a handy bit of technology that you can use that will cause the UI to do this job for
you.
Just follow the steps below and you will solve this problem. The sequence field will be populated in your empty line, and any elements that are added from then on will have an appropriate value in the sequence field. If the user edits the sequence field at any point, the next element added to the list will incorporate the change without any problems.
function initializeNewElement_LIST_NAME(newElement) {
var myListName = "LIST_NAME";
var myListSeqName = "FIELD_NAME";
var myListMaxSeq = 999;
defaultSequenceNumber(myListName,myListSeqName,myListMaxSeq,newElement)
}
</SCRIPT>
<SCRIPT src="/zz/defaultSequenceNumber/defaultSequenceNumber.js"></SCRIPT>
<SCRIPT>
LIST_NAME
, substitute your List Grid's list name. Be careful
not to lose that underscore [ _ ] just in front of LIST_NAME
in the
first line! Remember that JavaScript is case-sensitive and make sure that you use
all UPPERCASE letters as shown here.FIELD_NAME
, substitute the name of your sequence field,
whatever that might be in your List. Don't lose the quotes [ " ] ! Again, use all
UPPERCASE letters.