details:   /erp/devel/pi/rev/8ff121e5fd91
changeset: 10279:8ff121e5fd91
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Tue Feb 01 11:23:24 2011 +0100
summary:   Solved failing open on tab

details:   /erp/devel/pi/rev/a933118e54d2
changeset: 10280:a933118e54d2
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Tue Feb 01 11:24:36 2011 +0100
summary:   Enabled toolbar buttons for grid editing, solved tab title updating 
for grid editing

diffstat:

 
modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-grid.js.ftl
 |     5 +
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
        |    19 +-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js
              |     8 +
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
            |  2136 +++++----
 4 files changed, 1128 insertions(+), 1040 deletions(-)

diffs (truncated from 2354 to 300 lines):

diff -r a0cf9d9a2b36 -r a933118e54d2 
modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-grid.js.ftl
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-grid.js.ftl
       Tue Feb 01 11:02:41 2011 +0100
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-grid.js.ftl
       Tue Feb 01 11:24:36 2011 +0100
@@ -24,6 +24,7 @@
         autoExpand: ${field.autoExpand}, type: '${field.type}',
         editorProperties: {
           ${field.gridEditorFieldProperties}
+          // note need to be repeated for editor fields
           , columnName: '${field.columnName?js_string}'
           , inpColumnName: '${field.inpColumnName?js_string}'
           , referencedKeyColumnName: 
'${field.referencedKeyColumnName?js_string}'        
@@ -34,6 +35,10 @@
         , title: '${field.title?js_string}'
         , prompt: '${field.title?js_string}'
         , showIf: '${field.initialShow?string}'
+        , columnName: '${field.columnName?js_string}'
+        , inpColumnName: '${field.inpColumnName?js_string}'
+        , referencedKeyColumnName: 
'${field.referencedKeyColumnName?js_string}'        
+        , targetEntity: '${field.targetEntity?js_string}'
        }
        <#if field_has_next>,</#if>
     </#list>
diff -r a0cf9d9a2b36 -r a933118e54d2 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
      Tue Feb 01 11:02:41 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
      Tue Feb 01 11:24:36 2011 +0100
@@ -977,7 +977,7 @@
     var prefix = '', postFix;
     var suffix = '';
     var hasChanged = this.isShowingForm && (this.viewForm.isNew || 
this.viewForm.hasChanged);
-    hasChanged = hasChanged || (this.isEditingGrid && 
(this.viewGrid.getEditForm().isNew || this.viewGrid.getEditForm().hasChanged)); 
+    hasChanged = hasChanged || (this.isEditingGrid && 
(this.viewGrid.hasErrors() || this.viewGrid.getEditForm().isNew || 
this.viewGrid.getEditForm().hasChanged)); 
     if (hasChanged) {
       if (isc.Page.isRTL()) {
         suffix = ' *';
@@ -1099,7 +1099,11 @@
   },
   
   saveRow: function(){
-    this.viewForm.saveRow();
+    if (this.isEditingGrid) {
+      this.viewGrid.endEditing();
+    } else {
+      this.viewForm.saveRow();
+    }
   },
   
   deleteRow: function(){
@@ -1177,11 +1181,16 @@
   },
   
   undo: function(){
-    var view = this, callback;
-    if (this.viewForm.hasChanged) {
+    var view = this, callback, form;
+    if (this.isEditingGrid) {
+      form = this.viewGrid.getEditForm();
+    } else {
+      form = this.viewForm;
+    }
+    if (form.hasChanged) {
       callback = function(ok){
         if (ok) {
-          view.viewForm.undo();
+          form.undo();
         }
       };
       isc.ask(OB.I18N.getLabel('OBUIAPP_ConfirmUndo', callback), callback);
diff -r a0cf9d9a2b36 -r a933118e54d2 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js
    Tue Feb 01 11:02:41 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js
    Tue Feb 01 11:24:36 2011 +0100
@@ -38,6 +38,10 @@
       if (view.isShowingForm) {
         this.setDisabled(!form.isNew && (form.isSaving || form.readOnly || 
               !view.hasValidState() || !form.hasChanged));
+      } else if (view.isEditingGrid) {
+          form = view.viewGrid.getEditForm();
+          this.setDisabled(!form.isNew && (form.isSaving || form.readOnly || 
+                !view.hasValidState() || !form.hasChanged));
       } else {
         // enable when supporting grid editing
         this.setDisabled(true);
@@ -121,6 +125,10 @@
       if (view.isShowingForm) {
         this.setDisabled(form.isSaving || form.readOnly || 
!view.hasValidState() || 
             !form.hasChanged);
+      } else if (view.isEditingGrid) {
+        form = grid.getEditForm();
+        this.setDisabled(!form.isNew && (form.isSaving || form.readOnly || 
+              !view.hasValidState() || !form.hasChanged));
       } else {
         // support for editable grid
         this.setDisabled(true);
diff -r a0cf9d9a2b36 -r a933118e54d2 
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-view-grid.js
  Tue Feb 01 11:02:41 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
  Tue Feb 01 11:24:36 2011 +0100
@@ -18,1013 +18,1078 @@
  */
 isc.ClassFactory.defineClass('OBViewGrid', isc.OBGrid);
 
-isc.OBViewGrid.addClassProperties({
-  EDIT_LINK_FIELD_NAME: '_editLink',
-  NO_COUNT_PARAMETER: '_noCount', // prevent the count operation on the server
+isc.OBViewGrid.addClassProperties( {
+  EDIT_LINK_FIELD_NAME : '_editLink',
+  NO_COUNT_PARAMETER : '_noCount', // prevent the count operation on the server
   // note following 2 values should be the same
   // ListGrid._$ArrowUp and ListGrid._$ArrowDown
-  ARROW_UP_KEY_NAME: 'Arrow_Up',
-  ARROW_DOWN_KEY_NAME: 'Arrow_Down'
+  ARROW_UP_KEY_NAME : 'Arrow_Up',
+  ARROW_DOWN_KEY_NAME : 'Arrow_Down'
 });
 
 // = OBViewGrid =
 // The OBViewGrid is the Openbravo specific subclass of the Smartclient
 // ListGrid.
-isc.OBViewGrid.addProperties({
+isc.OBViewGrid
+    .addProperties( {
 
-  // ** {{{ view }}} **
-  // The view member contains the pointer to the composite canvas which
-  // handles this form
-  // and the grid and other related components.
-  view: null,
-  
-  // ** {{{ foreignKeyFieldNames }}} **
-  // The list of fields which are foreign keys, these require custom
-  // filtering.
-  foreignKeyFieldNames: [],
-  
-  // ** {{{ editGrid }}} **
-  // Controls if an edit link column is created in the grid, set to false to
-  // prevent this.
-  editGrid: true,
-  
-  // ** {{{ editLinkFieldProperties }}} **
-  // The properties of the ListGridField created for the edit links.
-  editLinkFieldProperties: {
-    type: 'text',
-    canSort: false,
-    frozen: true,
-    canFreeze: true,
-    canEdit: false,
-    canGroupBy: false,
-    canHide: false,
-    showTitle: true,
-    title: '&nbsp;',
-    autoFitWidth: true,
-    canDragResize: false,
-    canFilter: true,
-    autoExpand: false,
-    filterEditorType: 'StaticTextItem',
-    filterEditorProperties: {
-      textAlign: 'center'
-    },
-    name: isc.OBViewGrid.EDIT_LINK_FIELD_NAME
-  },
-  
-  // ** {{{ dataPageSize }}} **
-  // The data page size used for loading paged data from the server.
-  dataPageSize: 100,
-  
-  autoFitFieldWidths: true,
-  autoFitWidthApproach: 'title',
-  canAutoFitFields: false,
-  width: '100%',
-  height: '100%',
-  
-  autoFetchTextMatchStyle: 'substring',
-  showFilterEditor: true,
-  canEdit: true,
-  alternateRecordStyles: true,
-  canReorderFields: true,
-  canFreezeFields: true,
-  canAddFormulaFields: true,
-  canAddSummaryFields: true,
-  canGroupBy: false,
-  selectionAppearance: 'checkbox',
-  useAllDataSourceFields: false,
-  editEvent: 'none',
-  showCellContextMenus: true,
-  canOpenRecordEditor: true,
-  showDetailFields: true,
-  showErrorIcons : false,
+      // ** {{{ view }}} **
+      // The view member contains the pointer to the composite canvas which
+      // handles this form
+      // and the grid and other related components.
+      view : null,
 
-  // internal sc grid property, see the ListGrid source code
-  preserveEditsOnSetData: false,
-  
-  // enabling this results in a slower user interaction
-  // it is better to allow fast grid interaction and if an error occurs
-  // dismiss any new records being edited and go back to the edit row 
-  // which causes the error
-  waitForSave: false,
-  stopOnErrors: false,
-  confirmDiscardEdits: true,
-  
-  canMultiSort: false,
-  
-  emptyMessage: OB.I18N.getLabel('OBUISC_ListGrid.loadingDataMessage'),
-  discardEditsSaveButtonTitle: OB.I18N.getLabel('UINAVBA_Save'),
-  
-  quickDrawAheadRatio: 6.0,
-  drawAheadRatio: 4.0,
-  // note: don't set drawAllMaxCells too high as it results in extra reads
-  // of data, Smartclient will try to read until drawAllMaxCells has been 
reached
-  drawAllMaxCells: 100,
-  
-  // keeps track if we are in objectSelectionMode or in toggleSelectionMode
-  // objectSelectionMode = singleRecordSelection === true  
-  singleRecordSelection: false,
-  
-  // editing props
-  rowEndEditAction: 'next',
-  enforceVClipping: true,
-  
-  currentEditColumnLayout: null,
-  
-  dataProperties: {
-    useClientFiltering: false,
-    useClientSorting: false,
-    
-    transformData: function(newData, dsResponse){
-      // correct the length if there is already data in the localData array
-      if (this.localData) {
-        for (var i = dsResponse.endRow + 1; i < this.localData.length; i++) {
-          if (!Array.isLoading(this.localData[i]) && this.localData[i]) {
-            dsResponse.totalRows = i + 1;
-          } else {
-            break;
+      // ** {{{ foreignKeyFieldNames }}} **
+      // The list of fields which are foreign keys, these require custom
+      // filtering.
+      foreignKeyFieldNames : [],
+
+      // ** {{{ editGrid }}} **
+      // Controls if an edit link column is created in the grid, set to false 
to
+      // prevent this.
+      editGrid : true,
+
+      // ** {{{ editLinkFieldProperties }}} **
+      // The properties of the ListGridField created for the edit links.
+      editLinkFieldProperties : {
+        type : 'text',
+        canSort : false,
+        frozen : true,
+        canFreeze : true,
+        canEdit : false,
+        canGroupBy : false,
+        canHide : false,
+        showTitle : true,
+        title : '&nbsp;',
+        autoFitWidth : true,
+        canDragResize : false,
+        canFilter : true,
+        autoExpand : false,
+        filterEditorType : 'StaticTextItem',
+        filterEditorProperties : {
+          textAlign : 'center'
+        },
+        name : isc.OBViewGrid.EDIT_LINK_FIELD_NAME
+      },
+
+      // ** {{{ dataPageSize }}} **
+      // The data page size used for loading paged data from the server.
+      dataPageSize : 100,
+
+      autoFitFieldWidths : true,
+      autoFitWidthApproach : 'title',
+      canAutoFitFields : false,
+      width : '100%',
+      height : '100%',
+
+      autoFetchTextMatchStyle : 'substring',
+      showFilterEditor : true,
+      canEdit : true,
+      alternateRecordStyles : true,
+      canReorderFields : true,
+      canFreezeFields : true,
+      canAddFormulaFields : true,
+      canAddSummaryFields : true,
+      canGroupBy : false,
+      selectionAppearance : 'checkbox',
+      useAllDataSourceFields : false,
+      editEvent : 'none',
+      showCellContextMenus : true,
+      canOpenRecordEditor : true,
+      showDetailFields : true,
+      showErrorIcons : false,
+
+      // internal sc grid property, see the ListGrid source code
+      preserveEditsOnSetData : false,
+
+      // enabling this results in a slower user interaction
+      // it is better to allow fast grid interaction and if an error occurs

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to