Index: simple_grid.js =================================================================== --- simple_grid.js (revision 13936) +++ simple_grid.js (working copy) @@ -32,11 +32,21 @@ return ; } - var $i = 0; - while ($i < this.ItemIDs.length) { - this.getControl('number_' + this.ItemIDs[$i]).innerHTML = $i + 1; - $i++; - } + var $me = this; + var $number = 1; + + $('> div', this.getControl('container')).each( + function () { + var $div_id = $(this).attr('id'); + + if ( !$div_id.match( new RegExp('^' + $me.IDPrefix + '_(.*)') ) ) { + return ; + } + + $('#' + jq($me.IDPrefix + '_number_' + RegExp.$1)).html($number); + $number++; + } + ); } SimpleGrid.prototype.nextNumber = function () { @@ -127,6 +137,8 @@ var $js_mask = this.getControl('js_mask').value; var result_js = $js_mask.replace(/#NUMBER#/g, new_item_number); eval(result_js); + + this.renumberRecords(); this.updateTotals(); return new_item_number;