From f22300b39a4a8f58f78c34c4da07fbf29a2d1f73 Mon Sep 17 00:00:00 2001
From: legac <renaud.legac@free.fr>
Date: Sun, 16 Feb 2014 12:35:34 +0100
Subject: [PATCH] Move the handler oncheckItem fom MathaJax plugin to ExperMenu
 button.

---
 .../plugin_dbui/src/grid/button/ExpertMenu.js | 30 ++++++++++++++++++-
 static/plugin_dbui/src/grid/plugin/MathJax.js | 23 --------------
 2 files changed, 29 insertions(+), 24 deletions(-)

diff --git a/static/plugin_dbui/src/grid/button/ExpertMenu.js b/static/plugin_dbui/src/grid/button/ExpertMenu.js
index 9e50620d..f2d86039 100644
--- a/static/plugin_dbui/src/grid/button/ExpertMenu.js
+++ b/static/plugin_dbui/src/grid/button/ExpertMenu.js
@@ -56,9 +56,37 @@ Ext.define('App.grid.button.ExpertMenu', {
         // initialise the base class
         this.callParent(arguments);
 
+        // process checkItem event
         if (pGridMathJax) {
             this.buttonMathJax = this.menu.getComponent('buttonMathJax');
-            this.buttonMathJax.on('checkchange', pGridMathJax.onCheckItemChange, pGridMathJax);
+            this.buttonMathJax.on('checkchange', this.onCheckItemChange, pGridMathJax);
+        }
+    },
+
+    /**
+     * Activate /deactivate the MathJax processing.
+     * Private handler used by the expert menu.
+     *
+     * @param {Ext.menu.CheckItem} menuItem
+     * @param {Boolean} checked
+     * @param {Object} eOpts
+     *
+     */
+    onCheckItemChange: function (menuItem, checked, eOpts) {
+
+        "use strict";
+
+        var pGridMathJax = this;
+
+        pGridMathJax.activated = checked;
+
+        // process equation
+        if (checked) {
+            pGridMathJax.onProcessMath();
+
+        // refresh the grid
+        } else {
+            pGridMathJax.getCmp().getView().refresh();
         }
     },
 
diff --git a/static/plugin_dbui/src/grid/plugin/MathJax.js b/static/plugin_dbui/src/grid/plugin/MathJax.js
index 5615c327..99863834 100644
--- a/static/plugin_dbui/src/grid/plugin/MathJax.js
+++ b/static/plugin_dbui/src/grid/plugin/MathJax.js
@@ -48,29 +48,6 @@ Ext.define('App.grid.plugin.MathJax', {
         this.getCmp().getView().un('refresh', this.onProcessMath, this);
     },
 
-    /**
-     * Activate /deactivate the MathJax processing.
-     * Private handler used by the expert menu.
-     *
-     * @param {Ext.menu.CheckItem} menuItem
-     * @param {Boolean} checked
-     * @param {Object} eOpts
-     *
-     */
-    onCheckItemChange: function (menuItem, checked, eOpts) {
-
-        "use strict";
-
-        this.activated = checked;
-
-        if (this.activated) {
-            this.onProcessMath();
-
-        } else {
-            this.getCmp().getView().refresh();
-        }
-    },
-
     /**
      * Process maths objects
      *
-- 
GitLab