[icinga-checkins] icinga.org: icinga-web/next: Handling of GridEvents - ExpandActions ugly

git at icinga.org git at icinga.org
Tue Apr 2 15:42:02 CEST 2013


Module: icinga-web
Branch: next
Commit: 79660a52ed6b611cf0c0bdd434cfbdb2e3b4a9c0
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=79660a52ed6b611cf0c0bdd434cfbdb2e3b4a9c0

Author: Marius Hein <marius.hein at netways.de>
Date:   Tue Apr  2 15:37:34 2013 +0200

Handling of GridEvents - ExpandActions ugly

This commit isolate handling, row expander has nothing
to do with selectionModel and vice-versa. So every
part can be used without any side effects. Removed
registering of any unused handler.

Add arrow handler to move arround by keyboard. Arrow right
expands, arrow left collapse the panel.

fixes #3911

---

 .../lib/js/Cronk/grid/plugins/RowActionPanel.js    |   33 ++++++++++++++-----
 1 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/app/modules/Cronks/lib/js/Cronk/grid/plugins/RowActionPanel.js b/app/modules/Cronks/lib/js/Cronk/grid/plugins/RowActionPanel.js
index 259d93b..a08c3e4 100644
--- a/app/modules/Cronks/lib/js/Cronk/grid/plugins/RowActionPanel.js
+++ b/app/modules/Cronks/lib/js/Cronk/grid/plugins/RowActionPanel.js
@@ -161,22 +161,37 @@ Ext.ns("Cronk.grid.plugins");
             var renderer = Cronk.grid.WidgetRenderer.eventIcon({
                 iconCls: this.iconCls,
                 tooltip: _("Click to expand ..."),
-                scope: this,
-                listener: {
-                    mousedown: this.onMouseDown
-                }
+                scope: this
             });
             
             // Also show the panel on selection
             this.grid.on("cellclick", function(sm, rowIndex,cellIndex, record) {
-                if(cellIndex == 1)
+                if(cellIndex === 1) {
                     this.toggleHandler(rowIndex);
+                }
             }, this);
-            
-            this.grid.getSelectionModel().on("rowdeselect", function(sm, rowIndex, record) {
-                this.hidePanel(rowIndex);
+
+            /*
+             * Enable panel view on ARROW_LEFT key down if selected
+             */
+            this.grid.on('keydown', function(event) {
+                var selection = this.grid.getSelectionModel();
+                var selected = selection.getSelected();
+
+                // 39 == ARROW_RIGHT
+                if (event.getCharCode() === 39) {
+                    this.showPanel(selected.id-1);
+                } else if (event.getCharCode() === 37) { // 37 == ARROW_LEFT
+                    this.hidePanel(selected.id-1);
+                }
             }, this);
-            
+
+            // Deselect removed because of #3911
+            // @todo test for good handling / UA
+            // this.grid.getSelectionModel().on("rowdeselect", function(sm, rowIndex, record) {
+            //     this.hidePanel(rowIndex);
+            // }, this, {delay: 1000});
+
             //this.grid.on("rowclick", function(grid, rowIndex) {
             //    this.toggleHandler(rowIndex);
             //}, this);





More information about the icinga-checkins mailing list