Commit bf5ed706 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update grid/Filter.js to add configs dateFieldBufferChange,...

Update grid/Filter.js to add configs dateFieldBufferChange, textFieldBufferChange and the handler onGO.
parent 0fac0900
......@@ -46,6 +46,29 @@ Ext.define("Dbui.grid.Filter", {
}
},
/**
* @cfg{number} dateFieldBufferChange
* Reschedule the handler "onChange" after the specifed nunmber of
* milliseconds. If the event fires again within that time,
* the original handler is not invoked, but the new handler
* is scheduled in its place. This parameter is used for fields:
* "numberfield", "textfield", "textarea" and "textareafield".
*
*/
dateFieldBufferChange: 2000,
/**
* @cfg{number} textFieldBufferChange
* Reschedule the handler "onChange" after the specifed nunmber of
* milliseconds. If the event fires again within that time,
* the original handler is not invoked, but the new handler
* is scheduled in its place. This parameter is used for fields:
* "datefield" and "timefield".
*
*/
textFieldBufferChange: 1000,
// Private object containing where clause related to the filter request.
// this is used when running with a buffered store.
filterConditions: {},
......@@ -72,9 +95,6 @@ Ext.define("Dbui.grid.Filter", {
// initialise the base class
me.callParent(arguments);
// setup trigers
me.setTrigger();
},
// private method requires by the Ext JS component model
......@@ -94,8 +114,11 @@ Ext.define("Dbui.grid.Filter", {
/**
* Bind the grid filter to the grid
* @param {Ext.grid.Panel} grid
* @param {Boolean} onChange
* Grid filtering is activate as soon as one field of the selector
* change (true) or when the Go button is pressed (false)
*/
bind: function (grid) {
bind: function (grid, onChange) {
"use strict";
......@@ -105,6 +128,11 @@ Ext.define("Dbui.grid.Filter", {
me.grid = grid;
// setup triggers when the content of one field is change
if (onChange) {
me.setTrigger();
}
// clicking the reset button of the grid reset the filter's fields.
if (buttons && buttons[0] && buttons[0].menu) {
buttonReset = buttons[0].menu.getComponent("buttonReset");
......@@ -249,6 +277,27 @@ Ext.define("Dbui.grid.Filter", {
}
},
/**
* Handler to filter the store by using field values
*
*/
onGo: function() {
"use strict";
var me = this;
if (me.grid.remoteAction) {
Dbui.getFields(me).forEach(function (field) {
me.remoteFiltering(field);
});
} else {
Dbui.getFields(me).forEach(function (field) {
me.localFiltering(field);
});
}
},
/**
* Handler to reset the filter and the store content
*/
......@@ -349,7 +398,7 @@ Ext.define("Dbui.grid.Filter", {
case "datefield":
case "timefield":
field.on("change", me.onChange, me, {
buffer: 1000
buffer: me.dateFieldBufferChange
});
break;
......@@ -358,7 +407,7 @@ Ext.define("Dbui.grid.Filter", {
case "textarea":
case "textareafield":
field.on("change", me.onChange, me, {
buffer: 500
buffer: me.textFieldBufferChange
});
break;
......
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