Solve issue that new row was not inserted in logical place
authorMartin Taal <martin.taal@openbravo.com>
Tue, 08 Mar 2011 15:57:53 +0100
changeset 11105 b2a677fef048
parent 11104 06163e1d01f1
child 11106 94bf671228f7
Solve issue that new row was not inserted in logical place
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js	Tue Mar 08 15:30:02 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js	Tue Mar 08 15:57:53 2011 +0100
@@ -765,11 +765,11 @@
   
   // ** {{{ editNewRecordGrid }}} **
   // Opens the inline grid editing for a new record.
-  editNewRecordGrid: function() {
+  editNewRecordGrid: function(rowNum) {
     if (this.isShowingForm) {
       this.switchFormGridVisibility();      
     }
-    this.viewGrid.startEditingNew();
+    this.viewGrid.startEditingNew(rowNum);
   },
   
   // ** {{{ editRecord }}} **
@@ -1346,11 +1346,11 @@
     isc.ask(msg, callback);
   },
   
-  newRow: function() {
+  newRow: function(rowNum) {
     var actionObject = {
         target: this,
         method: this.editNewRecordGrid,
-        parameters: null
+        parameters: [rowNum]
       };
     this.standardWindow.doActionAfterAutoSave(actionObject, true);
   },
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js	Tue Mar 08 15:30:02 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js	Tue Mar 08 15:57:53 2011 +0100
@@ -96,7 +96,8 @@
   },
   NEW_ROW_BUTTON_PROPERTIES: {
     action: function(){
-      this.view.newRow();
+      // do -1 because the newrow logic adds one
+      this.view.newRow(this.view.viewGrid.getDrawArea()[0] - 1);
     },
     buttonType: 'newRow',
     prompt: OB.I18N.getLabel('OBUIAPP_NewRow'),
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js	Tue Mar 08 15:30:02 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js	Tue Mar 08 15:57:53 2011 +0100
@@ -1202,7 +1202,7 @@
   // +++++++++++++++++ functions for the editing +++++++++++++++++
   
   startEditingNew: function(rowNum){
-    var insertRow = this.getDrawArea()[0];
+    var insertRow;
     if (rowNum || rowNum === 0) {
       insertRow = rowNum + 1;
     } else {
@@ -1229,6 +1229,7 @@
     };
     
     this.data.insertCacheData(record, rowNum);
+    this.scrollToRow(rowNum);
     this.updateRowCountDisplay();
     this.redraw();
   },