details:   /erp/devel/pi/rev/939c19733a2e
changeset: 12548:939c19733a2e
user:      David Baz Fayos <david.baz <at> openbravo.com>
date:      Mon May 30 18:59:16 2011 +0200
summary:   [KS] Ensure that just 'Enter' is valid in selector links

details:   /erp/devel/pi/rev/65c18041b486
changeset: 12549:65c18041b486
user:      David Baz Fayos <david.baz <at> openbravo.com>
date:      Mon May 30 18:59:37 2011 +0200
summary:   [KS] Added more grid related shortcuts

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js
             |  59 ++++++++++
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
        |   6 +-
 
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
 |   2 +-
 3 files changed, 64 insertions(+), 3 deletions(-)

diffs (115 lines):

diff -r d606c372f256 -r 65c18041b486 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js
  Mon May 30 18:03:37 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js
  Mon May 30 18:59:37 2011 +0200
@@ -31,6 +31,40 @@
   poolComponentsPerColumn: true,
   showRecordComponents: true,
   escapeHTML: true,
+
+  bodyKeyPress : function (event, eventInfo) {
+    if (event.keyName === 'F' && 
+      (isc.EventHandler.ctrlKeyDown() && !isc.EventHandler.altKeyDown() && 
isc.EventHandler.shiftKeyDown())) {
+      var i;
+      for (i=0; i<this.fields.length; i++) {
+        if (this.fields[i].name !== '_checkboxField' && this.fields[i].name 
!== '_editLink') {
+          this.focusInFilterEditor(this.fields[i].name);
+          return false;
+        }
+      }
+    }
+
+    if (event.keyName === 'Delete' && 
+      (!isc.EventHandler.ctrlKeyDown() && isc.EventHandler.altKeyDown() && 
!isc.EventHandler.shiftKeyDown())) {
+      this.clearCriteria();
+      return false;
+    }
+
+    if (event.keyName === 'A' && 
+      (isc.EventHandler.ctrlKeyDown() && !isc.EventHandler.altKeyDown() && 
!isc.EventHandler.shiftKeyDown())) {
+      this.selectAllRecords();
+      return false;
+    }
+
+    if (event.keyName === 'Escape' && 
+      (!isc.EventHandler.ctrlKeyDown() && !isc.EventHandler.altKeyDown() && 
!isc.EventHandler.shiftKeyDown())) {
+      if (this.getSelectedRecords().length > 1) {
+        this.deselectAllRecords();
+      }
+      return false;
+    }
+    return this.Super('bodyKeyPress', arguments);
+  },
   
   createRecordComponent: function(record, colNum){
     var field = this.getField(colNum), rowNum = this.getRecordIndex(record);
@@ -81,9 +115,34 @@
       return '';
     };
 
+    setFieldsKeyDown = function(item, form, keyName) {
+      if (isc.EventHandler.getKeyName() === 'Delete' && 
+        (!isc.EventHandler.ctrlKeyDown() && isc.EventHandler.altKeyDown() && 
!isc.EventHandler.shiftKeyDown())) {
+        thisGrid.clearCriteria();
+        return false;
+      }
+      if (isc.EventHandler.getKeyName() === 'Escape' && 
+        (!isc.EventHandler.ctrlKeyDown() && !isc.EventHandler.altKeyDown() && 
!isc.EventHandler.shiftKeyDown())) {
+        thisGrid.focus();
+        return false;
+      }
+      if (isc.EventHandler.getKeyName() === 'Tab' && 
+        (!isc.EventHandler.ctrlKeyDown() && !isc.EventHandler.altKeyDown())) {
+        return false; // To avoid strange double field jump while pressing Tab 
Key
+      }
+      return this.Super('keyPress', arguments);
+    };
+
     if (this.fields) {
       for (i = 0; i < this.fields.length; i++) {
         field = this.fields[i];
+
+        if (!field.filterEditorProperties) {
+          field.filterEditorProperties = {};
+        }
+
+        field.filterEditorProperties.keyDown = setFieldsKeyDown;
+
         if (field.isLink) {
           // store the originalFormatCellValue if not already set
           if (field.formatCellValue && !field.formatCellValueFunctionReplaced) 
{
diff -r d606c372f256 -r 65c18041b486 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
     Mon May 30 18:03:37 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
     Mon May 30 18:59:37 2011 +0200
@@ -401,9 +401,10 @@
 
   // handle the del key when rows have been selected or space key
   bodyKeyPress : function (event, eventInfo) {
-    if (event.keyName === 'Delete' && this.getSelectedRecords().length > 0) {
+    if (event.keyName === 'Delete' && this.getSelectedRecords().length > 0 && 
+      (!isc.EventHandler.ctrlKeyDown() && !isc.EventHandler.altKeyDown() && 
!isc.EventHandler.shiftKeyDown())) {
       this.view.deleteSelectedRows();
-      return;      
+      return false;
     }
     // don't let the default space action do something if others keys are also 
     // pressed
@@ -411,6 +412,7 @@
       (isc.EventHandler.ctrlKeyDown() || isc.EventHandler.altKeyDown() || 
isc.EventHandler.shiftKeyDown())) {
       return true;
     }
+
     return this.Super('bodyKeyPress', arguments);
   },
 
diff -r d606c372f256 -r 65c18041b486 
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
--- 
a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
      Mon May 30 18:03:37 2011 +0200
+++ 
b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
      Mon May 30 18:59:37 2011 +0200
@@ -617,7 +617,7 @@
   },
   
   keyPress: function(item, form, keyName, characterValue){
-    if (keyName === 'Enter') {
+    if (keyName === 'Enter' && !isc.EventHandler.ctrlKeyDown() && 
!isc.EventHandler.altKeyDown() && !isc.EventHandler.shiftKeyDown()) {
       this.showPicker();
       return false;
     }

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to