Commit 64a8e9ba authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update panel with selector in order to uniformize interface.

parent 5590a00a
...@@ -162,6 +162,11 @@ Ext.define("Dbui.panel.BaseWithSelector", { ...@@ -162,6 +162,11 @@ Ext.define("Dbui.panel.BaseWithSelector", {
*/ */
selectorPanel: null, selectorPanel: null,
// private key map
keyMap: {
ENTER: "onEnterKey"
},
// Private attribute for internationalization // Private attribute for internationalization
textGo: "Go", textGo: "Go",
textReset: "Reset", textReset: "Reset",
...@@ -227,7 +232,22 @@ Ext.define("Dbui.panel.BaseWithSelector", { ...@@ -227,7 +232,22 @@ Ext.define("Dbui.panel.BaseWithSelector", {
toolbar = me.selectorPanel.getDockedItems()[0]; toolbar = me.selectorPanel.getDockedItems()[0];
me.goButton = toolbar.getComponent("goButton"); me.goButton = toolbar.getComponent("goButton");
me.resetButton = toolbar.getComponent("resetButton"); me.resetButton = toolbar.getComponent("resetButton");
} },
// jshint strict: true // jshint strict: true
/**
* Handler to click on the Go button when the ENTER key is pressed
*
*/
onEnterKey: function () {
"use strict";
var me = this;
// do it only when the panel is expanded but not collpased
if (!me.selectorPanel.getCollapsed()) {
me.goButton.click();
}
}
}); });
\ No newline at end of file
...@@ -26,11 +26,6 @@ Ext.define("Dbui.panel.GridWithFilter", { ...@@ -26,11 +26,6 @@ Ext.define("Dbui.panel.GridWithFilter", {
filter: null, filter: null,
grid: null, grid: null,
// private key map
keyMap: {
ENTER: "onEnterKey"
},
// Private properties for internationalization // Private properties for internationalization
textLoad: "Loading...", textLoad: "Loading...",
...@@ -49,7 +44,7 @@ Ext.define("Dbui.panel.GridWithFilter", { ...@@ -49,7 +44,7 @@ Ext.define("Dbui.panel.GridWithFilter", {
me.grid = me.mainPanel.child("xgrid"); me.grid = me.mainPanel.child("xgrid");
me.filter.bind(me.grid, me.filterOnChange); me.filter.bind(me.grid, me.filterOnChange);
// connect buttons // handling events
if (me.filterOnChange) { if (me.filterOnChange) {
me.keyMapEnabled = false; me.keyMapEnabled = false;
me.goButton.hide(); me.goButton.hide();
...@@ -59,10 +54,10 @@ Ext.define("Dbui.panel.GridWithFilter", { ...@@ -59,10 +54,10 @@ Ext.define("Dbui.panel.GridWithFilter", {
} }
me.resetButton.on("click", me.filter.onReset, me.filter); me.resetButton.on("click", me.filter.onReset, me.filter);
me.selectorPanel.on("expand", me.onSelectorExpand, me);
// collapse the selectorPanel // collapse the selectorPanel
me.selectorPanel.collapsed = true; me.selectorPanel.collapsed = true;
me.selectorPanel.on("expand", me.onSelectorExpand, me);
// Mask the GridFilter during loading // Mask the GridFilter during loading
me.grid.getView().loadMask = Ext.create("Ext.LoadMask", { me.grid.getView().loadMask = Ext.create("Ext.LoadMask", {
...@@ -81,28 +76,14 @@ Ext.define("Dbui.panel.GridWithFilter", { ...@@ -81,28 +76,14 @@ Ext.define("Dbui.panel.GridWithFilter", {
me.goButton.un("click", me.filter.onGo, me.filter); me.goButton.un("click", me.filter.onGo, me.filter);
} }
me.selectorPanel.un("expand", me.onSelectorExpand, me);
me.resetButton.un("click", me.filter.onReset, me.filter); me.resetButton.un("click", me.filter.onReset, me.filter);
me.selectorPanel.un("expand", me.onSelectorExpand, me);
me.callParent(arguments); me.callParent(arguments);
}, },
// jshint strict: true // jshint strict: true
/**
* Handler to click on the Go button when the ENTER key is pressed
*
*/
onEnterKey: function () {
"use strict";
var me = this;
// do it only when the panel is expanded but not collpased
if (!me.selectorPanel.getCollapsed()) {
me.goButton.click();
}
},
/** /**
* Handler to focus on the first field of the filter * Handler to focus on the first field of the filter
* when the selector is expand * when the selector is expand
......
...@@ -96,7 +96,7 @@ Ext.define("Dbui.panel.WithUrlSelector", { ...@@ -96,7 +96,7 @@ Ext.define("Dbui.panel.WithUrlSelector", {
me.mainPanel.loader.baseParams = me.baseParams; me.mainPanel.loader.baseParams = me.baseParams;
} }
// handlers for button // handling events
me.goButton.on("click", me.onGo, me); me.goButton.on("click", me.onGo, me);
me.resetButton.on("click", me.onReset, me); me.resetButton.on("click", me.onReset, me);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment