dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #37380
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19132: ER EV data filtering.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 19132 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-05-11 16:42:18 +0200
message:
ER EV data filtering.
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js 2015-05-09 13:05:23 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js 2015-05-11 14:41:56 +0000
@@ -3847,6 +3847,9 @@
stage,
onStageSelect,
loadDataElements,
+ dataElementLabel,
+ dataElementSearch,
+ dataElementFilter,
dataElementAvailable,
dataElementSelected,
addUxFromDataElement,
@@ -4282,6 +4285,9 @@
ns.app.aggregateLayoutWindow.value.resetData();
}
+ dataElementSearch.enable();
+ dataElementSearch.hideFilter();
+
loadDataElements(stageId, layout);
};
@@ -4342,7 +4348,86 @@
}
};
+ dataElementLabel = Ext.create('Ext.form.Label', {
+ text: NS.i18n.available,
+ cls: 'ns-toolbar-multiselect-left-label',
+ style: 'margin-right:5px'
+ });
+
+ dataElementSearch = Ext.create('Ext.button.Button', {
+ width: 22,
+ height: 22,
+ cls: 'ns-button-icon',
+ disabled: true,
+ style: 'background: url(images/search_14.png) 3px 3px no-repeat',
+ showFilter: function() {
+ dataElementLabel.hide();
+ this.hide();
+ dataElementFilter.show();
+ dataElementFilter.reset();
+ },
+ hideFilter: function() {
+ dataElementLabel.show();
+ this.show();
+ dataElementFilter.hide();
+ dataElementFilter.reset();
+ },
+ handler: function() {
+ this.showFilter();
+ }
+ });
+
+ dataElementFilter = Ext.create('Ext.form.field.Trigger', {
+ cls: 'ns-trigger-filter',
+ emptyText: 'Filter available..',
+ height: 22,
+ width: 170,
+ hidden: true,
+ enableKeyEvents: true,
+ fieldStyle: 'height:22px; border-right:0 none',
+ style: 'height:22px',
+ onTriggerClick: function() {
+ if (this.getValue()) {
+ this.reset();
+ this.onKeyUpHandler();
+ }
+ },
+ onKeyUpHandler: function() {
+ var store = dataElementsByStageStore,
+ value = this.getValue(),
+ name;
+
+ if (value === '') {
+ store.clearFilter();
+ return;
+ }
+
+ store.filterBy(function(r) {
+ name = r.data.name || '';
+ return name.toLowerCase().indexOf(value.toLowerCase()) !== -1;
+ });
+ },
+ listeners: {
+ keyup: {
+ fn: function(cmp) {
+ cmp.onKeyUpHandler();
+ },
+ buffer: 100
+ },
+ show: function(cmp) {
+ cmp.focus(false, 50);
+ },
+ focus: function(cmp) {
+ cmp.addCls('ns-trigger-filter-focused');
+ },
+ blur: function(cmp) {
+ cmp.removeCls('ns-trigger-filter-focused');
+ }
+ }
+ });
+
dataElementAvailable = Ext.create('Ext.ux.form.MultiSelect', {
+ cls: 'ns-toolbar-multiselect-left',
width: accBaseWidth,
height: 180,
valueField: 'id',
@@ -4350,12 +4435,9 @@
style: 'margin-bottom:1px',
store: dataElementsByStageStore,
tbar: [
- {
- xtype: 'label',
- text: 'Available data items',
- style: 'padding-left:6px; color:#222',
- cls: 'ns-toolbar-multiselect-left-label'
- },
+ dataElementLabel,
+ dataElementSearch,
+ dataElementFilter,
'->',
{
xtype: 'button',
@@ -6213,6 +6295,8 @@
dataElementsByStageStore.removeAll();
dataElementSelected.removeAll();
+ dataElementSearch.hideFilter();
+
startDate.reset();
endDate.reset();
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js 2015-05-09 13:05:23 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js 2015-05-11 14:41:56 +0000
@@ -3515,6 +3515,9 @@
stage,
onStageSelect,
loadDataElements,
+ dataElementLabel,
+ dataElementSearch,
+ dataElementFilter,
dataElementAvailable,
dataElementSelected,
addUxFromDataElement,
@@ -3946,6 +3949,9 @@
ns.app.aggregateLayoutWindow.value.resetData();
}
+ dataElementSearch.enable();
+ dataElementSearch.hideFilter();
+
loadDataElements(stageId, layout);
};
@@ -4006,7 +4012,86 @@
}
};
+ dataElementLabel = Ext.create('Ext.form.Label', {
+ text: NS.i18n.available,
+ cls: 'ns-toolbar-multiselect-left-label',
+ style: 'margin-right:5px'
+ });
+
+ dataElementSearch = Ext.create('Ext.button.Button', {
+ width: 22,
+ height: 22,
+ cls: 'ns-button-icon',
+ disabled: true,
+ style: 'background: url(images/search_14.png) 3px 3px no-repeat',
+ showFilter: function() {
+ dataElementLabel.hide();
+ this.hide();
+ dataElementFilter.show();
+ dataElementFilter.reset();
+ },
+ hideFilter: function() {
+ dataElementLabel.show();
+ this.show();
+ dataElementFilter.hide();
+ dataElementFilter.reset();
+ },
+ handler: function() {
+ this.showFilter();
+ }
+ });
+
+ dataElementFilter = Ext.create('Ext.form.field.Trigger', {
+ cls: 'ns-trigger-filter',
+ emptyText: 'Filter available..',
+ height: 22,
+ width: 170,
+ hidden: true,
+ enableKeyEvents: true,
+ fieldStyle: 'height:22px; border-right:0 none',
+ style: 'height:22px',
+ onTriggerClick: function() {
+ if (this.getValue()) {
+ this.reset();
+ this.onKeyUpHandler();
+ }
+ },
+ onKeyUpHandler: function() {
+ var store = dataElementsByStageStore,
+ value = this.getValue(),
+ name;
+
+ if (value === '') {
+ store.clearFilter();
+ return;
+ }
+
+ store.filterBy(function(r) {
+ name = r.data.name || '';
+ return name.toLowerCase().indexOf(value.toLowerCase()) !== -1;
+ });
+ },
+ listeners: {
+ keyup: {
+ fn: function(cmp) {
+ cmp.onKeyUpHandler();
+ },
+ buffer: 100
+ },
+ show: function(cmp) {
+ cmp.focus(false, 50);
+ },
+ focus: function(cmp) {
+ cmp.addCls('ns-trigger-filter-focused');
+ },
+ blur: function(cmp) {
+ cmp.removeCls('ns-trigger-filter-focused');
+ }
+ }
+ });
+
dataElementAvailable = Ext.create('Ext.ux.form.MultiSelect', {
+ cls: 'ns-toolbar-multiselect-left',
width: accBaseWidth,
height: 180,
valueField: 'id',
@@ -4014,12 +4099,9 @@
style: 'margin-bottom:1px',
store: dataElementsByStageStore,
tbar: [
- {
- xtype: 'label',
- text: 'Available data items',
- style: 'padding-left:6px; color:#222',
- cls: 'ns-toolbar-multiselect-left-label'
- },
+ dataElementLabel,
+ dataElementSearch,
+ dataElementFilter,
'->',
{
xtype: 'button',
@@ -5872,6 +5954,8 @@
dataElementsByStageStore.removeAll();
dataElementSelected.removeAll();
+ dataElementSearch.hideFilter();
+
startDate.reset();
endDate.reset();