details:   https://code.openbravo.com/erp/devel/pi/rev/0d16137a3524
changeset: 20163:0d16137a3524
user:      David Baz Fayos <david.baz <at> openbravo.com>
date:      Sat Apr 20 16:33:07 2013 +0200
summary:   Fixed issue 23602: Now 'Right click -> Delete' in grid performs
the same action than Toolbar 'Eliminate' button (if exists)

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
 |  17 +++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diffs (27 lines):

diff -r 0b2c505c3e21 -r 0d16137a3524 
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
     Sat Apr 20 16:00:10 2013 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
     Sat Apr 20 16:33:07 2013 +0200
@@ -2178,7 +2178,22 @@
         title: OB.I18N.getLabel('OBUIAPP_Delete'),
         keyTitle: OB.KeyboardManager.Shortcuts.getProperty('keyComb.text', 
'ToolBar_Eliminate', 'id'),
         click: function () {
-          grid.view.deleteSelectedRows();
+          // The click action should be the same than the toolbar button, so 
if this last one is overwritten, this click should perform the same action.
+          var isToolbarButtonFound = false,
+              i;
+          if (grid.view.toolBar && grid.view.toolBar.leftMembers && 
isc.OBToolbar.TYPE_DELETE) {
+            for (i = 0; i < grid.view.toolBar.leftMembers.length; i++) {
+              if (grid.view.toolBar.leftMembers[i].buttonType === 
isc.OBToolbar.TYPE_DELETE) {
+                isToolbarButtonFound = true;
+                grid.view.toolBar.leftMembers[i].action();
+                break;
+              }
+            }
+          }
+          // But if the toolbar button is not found, do the default action
+          if (!isToolbarButtonFound) {
+            grid.view.deleteSelectedRows();
+          }
         }
       });
     }

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to