dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #33780
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17303: ER option filtering improved.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 17303 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-10-28 15:45:24 +0100
message:
ER option filtering improved.
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/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 2014-10-28 12:49:51 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js 2014-10-28 14:44:03 +0000
@@ -483,7 +483,7 @@
});
this.searchStore = Ext.create('Ext.data.Store', {
- fields: [idProperty, 'name'],
+ fields: [idProperty, nameProperty],
data: [],
loadOptionSet: function(optionSetId, key, pageSize) {
var store = this;
@@ -493,8 +493,31 @@
dhis2.er.store.get('optionSets', optionSetId).done( function(obj) {
if (Ext.isObject(obj) && Ext.isArray(obj.options) && obj.options.length) {
+ var data = [];
+
+ if (key) {
+ var re = new RegExp(key, 'gi');
+
+ for (var i = 0, name, match; i < obj.options.length; i++) {
+ name = obj.options[i].name;
+ match = name.match(re);
+
+ if (Ext.isArray(match) && match.length) {
+ data.push(obj.options[i]);
+
+ if (data.length === pageSize) {
+ break;
+ }
+ }
+ }
+ }
+ else {
+ data = obj.options;
+ }
+
store.removeAll();
- store.loadData(obj.options.slice(0, pageSize));
+ store.loadData(data.slice(0, pageSize));
+
}
});
},
@@ -526,11 +549,10 @@
valueField: idProperty,
displayField: nameProperty,
hideTrigger: true,
- delimiter: '; ',
enableKeyEvents: true,
queryMode: 'local',
listConfig: {
- minWidth: 304
+ minWidth: 346
},
store: this.searchStore,
listeners: {
@@ -603,6 +625,7 @@
store: container.valueStore,
queryMode: 'local',
listConfig: {
+ minWidth: 266,
cls: 'optionselector'
},
setOptionValues: function(optionArray) {