Index: simple_grid.js =================================================================== --- simple_grid.js (revision 13756) +++ simple_grid.js (working copy) @@ -111,7 +111,7 @@ return $is_valid; } -SimpleGrid.prototype.addRecord = function () { +SimpleGrid.prototype.addRecord = function ($after_item_id) { var new_item_number = this.nextNumber(); var $item_mask = this.getControl('mask').value; @@ -119,12 +119,21 @@ var $div = document.createElement('DIV'); $div.id = this.IDPrefix + '_' + new_item_number; - this.getControl('container').appendChild($div); + + if ($after_item_id === undefined) { + this.getControl('container').appendChild($div); + } + else { + $('#' + jq(this.IDPrefix + '_' + $after_item_id)).after($div); + } + $div.innerHTML = $result_html; var $js_mask = this.getControl('js_mask').value; var result_js = $js_mask.replace(/#NUMBER#/g, new_item_number); eval(result_js); + + return new_item_number; } SimpleGrid.prototype.removeRecord = function ($number) {