[icinga-checkins] icinga.org: icinga-web/r1.8: Readded native state, metagrid now saves columnmove in the state, fixed downtimes are working again

git at icinga.org git at icinga.org
Mon Jan 14 11:15:14 CET 2013


Module: icinga-web
Branch: r1.8
Commit: e6ec7fa7e1721240d9d876c054e6ee5bfd571b7b
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=e6ec7fa7e1721240d9d876c054e6ee5bfd571b7b

Author: Jannis Mosshammer <jannis.mosshammer at netways.de>
Date:   Wed Dec 19 11:37:56 2012 +0100

Readded native state, metagrid now saves columnmove in the state, fixed downtimes are working again

---

 .../Cronks/lib/js/Cronk/grid/CommandHandler.js     |   20 ++++++++++++--------
 .../Cronks/lib/js/Cronk/grid/MetaGridPanel.js      |   12 +++++++++++-
 2 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/app/modules/Cronks/lib/js/Cronk/grid/CommandHandler.js b/app/modules/Cronks/lib/js/Cronk/grid/CommandHandler.js
index ec82f9e..32c1a79 100644
--- a/app/modules/Cronks/lib/js/Cronk/grid/CommandHandler.js
+++ b/app/modules/Cronks/lib/js/Cronk/grid/CommandHandler.js
@@ -217,15 +217,19 @@ Ext.ns('Cronk.grid');
                     }]
                 });
                 if (o.fieldName === "fixed") {
+                    AppKit.log(oDef);
                     var affectedForms = ['duration', 'duration-minute', 'duration-hour'];
-                    oDef.listeners = {
-                        change: function (rg, checkedBox) {
-                            for (var i = 0; i < affectedForms.length; i++) {
-                                var m = form.getForm().findField(affectedForms[i]);
-
-                                if (m) {
-                                    m.setReadOnly((checkedBox.initialConfig.boxLabel === _('Yes')) ? true : false);
-                                    m.container.setVisible((checkedBox.initialConfig.boxLabel === _('Yes')) ? false : true);
+                    for(var i=0;i<oDef.items.length;i++) {
+                        oDef.items[i].listeners = {
+                            check: function (checkedBox,val) {
+                                AppKit.log("?");
+                                for (var i = 0; i < affectedForms.length; i++) {
+                                    var m = form.getForm().findField(affectedForms[i]);
+
+                                    if (m) {
+                                        m.setReadOnly((checkedBox.initialConfig.boxLabel === _('Yes')) ? !val : val);
+                                        m.container.setVisible((checkedBox.initialConfig.boxLabel === _('Yes')) ? val : !val);
+                                    }
                                 }
                             }
                         }
diff --git a/app/modules/Cronks/lib/js/Cronk/grid/MetaGridPanel.js b/app/modules/Cronks/lib/js/Cronk/grid/MetaGridPanel.js
index fd10a9c..a96fa0d 100755
--- a/app/modules/Cronks/lib/js/Cronk/grid/MetaGridPanel.js
+++ b/app/modules/Cronks/lib/js/Cronk/grid/MetaGridPanel.js
@@ -557,6 +557,7 @@ Ext.ns("Cronk.grid");
                                         btn.setChecked(v, true);
                                     });
                                 },
+
                                 scope: this
 
                             },
@@ -837,6 +838,10 @@ Ext.ns("Cronk.grid");
                     msg: _("Loading ...")
                 });
             }, this);
+
+            this.on("columnmove", function(grid) {
+                this.saveState();
+            }, this);
         },
 
         /**
@@ -1010,6 +1015,7 @@ Ext.ns("Cronk.grid");
             var o = {
                 filter_params: this.filter_params || {},
                 filter_types: this.filter_types || {},
+                nativeState: Ext.grid.GridPanel.prototype.getState.apply(this),
                 store_origin_params: ("originParams" in store) ? store.originParams : {},
                 sortToggle: store.sortToggle,
                 sortInfo: store.sortInfo,
@@ -1076,7 +1082,11 @@ Ext.ns("Cronk.grid");
             if (state.connection) {
                 this.setConnection(state.connection);
             }
-
+            if (Ext.isObject(state.nativeState)) {
+                return Ext.grid.GridPanel.prototype.applyState.call(this, {
+                    columns: state.nativeState.columns
+                });
+            }
             return true;
         },
 





More information about the icinga-checkins mailing list