dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17334
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6852: (patient) Add filter for dataelement list in tabular report.
------------------------------------------------------------
revno: 6852
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-05-04 15:50:53 +0700
message:
(patient) Add filter for dataelement list in tabular report.
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/css/style.css
--
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-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2012-05-02 08:49:03 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2012-05-04 08:50:53 +0000
@@ -202,11 +202,16 @@
this.filterAvailable(a, s);
},
selectAll: function(a, s) {
- var array = [];
- a.store.each( function(r) {
- array.push({id: r.data.id, name: r.data.name});
- });
- s.store.add(array);
+ var array = [];
+ var elements = a.boundList.all.elements;
+ for( var i=0; i< elements.length; i++ )
+ {
+ if( elements[i].style.display != 'none' )
+ {
+ array.push({id: a.store.getAt(i).data.id, name: a.store.getAt(i).data.name});
+ }
+ }
+ s.store.add(array);
this.filterAvailable(a, s);
},
unselect: function(a, s) {
@@ -223,7 +228,7 @@
a.store.clearFilter();
},
filterAvailable: function(a, s) {
- a.store.filterBy( function(r) {
+ a.store.filterBy( function(r) {
var filter = true;
s.store.each( function(r2) {
if (r.data.id === r2.data.id) {
@@ -234,6 +239,21 @@
});
a.store.sort('name', 'ASC');
},
+ filterSelector: function(selectors, queryString) {
+ var elements = selectors.boundList.all.elements;
+
+ for( var i=0; i< elements.length; i++ )
+ {
+ if( elements[i].innerHTML.toLowerCase().indexOf( queryString ) != -1 )
+ {
+ elements[i].style.display = 'block';
+ }
+ else
+ {
+ elements[i].style.display = 'none';
+ }
+ }
+ },
setHeight: function(ms, panel, fill) {
for (var i = 0; i < ms.length; i++) {
ms[i].setHeight(panel.getHeight() - 45);
@@ -1714,18 +1734,13 @@
layout: 'column',
bodyStyle: 'border-style:none',
items: [
- Ext.create('Ext.ux.form.MultiSelect', {
- name: 'availableDataelementAttributes',
+ {
+ xtype: 'toolbar',
+ width: (TR.conf.layout.west_fieldset_width - TR.conf.layout.west_width_subtractor) / 2,
cls: 'tr-toolbar-multiselect-left',
- width: (TR.conf.layout.west_fieldset_width - TR.conf.layout.west_width_subtractor) / 2,
- height: 241,
- displayField: 'name',
- valueField: 'id',
- queryMode: 'remote',
- store: TR.store.dataelement.available,
- tbar: [
+ items: [
{
- xtype: 'label',
+ xtype: 'label',
text: TR.i18n.available,
cls: 'tr-toolbar-multiselect-left-label'
},
@@ -1736,6 +1751,7 @@
width: 22,
handler: function() {
TR.util.multiselect.select(TR.cmp.params.dataelement.available, TR.cmp.params.dataelement.selected);
+ TR.util.multiselect.filterSelector( TR.cmp.params.dataelement.available, Ext.getCmp('deFilterAvailable').getValue());
}
},
{
@@ -1744,9 +1760,69 @@
width: 22,
handler: function() {
TR.util.multiselect.selectAll(TR.cmp.params.dataelement.available, TR.cmp.params.dataelement.selected);
- }
- },
- ' '
+ TR.util.multiselect.filterSelector( TR.cmp.params.dataelement.available, Ext.getCmp('deFilterAvailable').getValue());
+ }
+ },
+ ''
+ ]
+ },
+ {
+ xtype: 'toolbar',
+ width: (TR.conf.layout.west_fieldset_width - TR.conf.layout.west_width_subtractor) / 2,
+ cls: 'tr-toolbar-multiselect-left',
+ items: [
+ ' ',
+ {
+ xtype: 'button',
+ icon: 'images/arrowleftdouble.png',
+ width: 22,
+ handler: function() {
+ TR.util.multiselect.unselectAll(TR.cmp.params.dataelement.available, TR.cmp.params.dataelement.selected);
+ TR.util.multiselect.filterSelector( TR.cmp.params.dataelement.available, Ext.getCmp('deFilterAvailable').getValue());
+ }
+ },
+ {
+ xtype: 'button',
+ icon: 'images/arrowleft.png',
+ width: 22,
+ handler: function() {
+ TR.util.multiselect.unselect(TR.cmp.params.dataelement.available, TR.cmp.params.dataelement.selected);
+ TR.util.multiselect.filterSelector( TR.cmp.params.dataelement.available, Ext.getCmp('deFilterAvailable').getValue());
+ }
+ },
+ '->',
+ {
+ xtype: 'label',
+ text: TR.i18n.selected,
+ cls: 'tr-toolbar-multiselect-right-label'
+ }
+ ]
+ },
+ {
+ xtype: 'multiselect',
+ name: 'availableDataelements',
+ cls: 'tr-toolbar-multiselect-left',
+ width: (TR.conf.layout.west_fieldset_width - TR.conf.layout.west_width_subtractor) / 2,
+ height: 215,
+ displayField: 'name',
+ valueField: 'id',
+ queryMode: 'remote',
+ store: TR.store.dataelement.available,
+ tbar: [
+ {
+ xtype: 'textfield',
+ emptyText: TR.i18n.filter,
+ id: 'deFilterAvailable',
+ width: (TR.conf.layout.west_fieldset_width - TR.conf.layout.west_width_subtractor) / 2 - 4,
+ listeners: {
+ specialkey: function( textfield, e, eOpts ){
+ if ( e.keyCode == e.ENTER )
+ {
+ TR.util.multiselect.filterSelector( TR.cmp.params.dataelement.available, textfield.rawValue.toLowerCase());
+ }
+ }
+ }
+ }
],
listeners: {
added: function() {
@@ -1755,44 +1831,36 @@
afterrender: function() {
this.boundList.on('itemdblclick', function() {
TR.util.multiselect.select(this, TR.cmp.params.dataelement.selected);
+ TR.util.multiselect.filterSelector( TR.cmp.params.dataelement.available, Ext.getCmp('deFilterAvailable').getValue());
}, this);
}
}
- }),
+ },
{
xtype: 'multiselect',
- name: 'selectedDataelementAttribute',
+ name: 'selectedDataelements',
cls: 'tr-toolbar-multiselect-right',
width: (TR.conf.layout.west_fieldset_width - TR.conf.layout.west_width_subtractor) / 2,
- height: 241,
+ height: 215,
displayField: 'name',
valueField: 'id',
ddReorder: true,
queryMode: 'remote',
store: TR.store.dataelement.selected,
tbar: [
- ' ',
- {
- xtype: 'button',
- icon: 'images/arrowleftdouble.png',
- width: 22,
- handler: function() {
- TR.util.multiselect.unselectAll(TR.cmp.params.dataelement.available, TR.cmp.params.dataelement.selected);
- }
- },
- {
- xtype: 'button',
- icon: 'images/arrowleft.png',
- width: 22,
- handler: function() {
- TR.util.multiselect.unselect(TR.cmp.params.dataelement.available, TR.cmp.params.dataelement.selected);
- }
- },
- '->',
- {
- xtype: 'label',
- text: TR.i18n.selected,
- cls: 'tr-toolbar-multiselect-right-label'
+ {
+ xtype: 'textfield',
+ emptyText: TR.i18n.filter,
+ id: 'deFilterSelected',
+ width: (TR.conf.layout.west_fieldset_width - TR.conf.layout.west_width_subtractor) / 2 - 4,
+ listeners: {
+ specialkey: function( textfield, e, eOpts ){
+ if ( e.keyCode == e.ENTER )
+ {
+ TR.util.multiselect.filterSelector( TR.cmp.params.dataelement.selected, textfield.rawValue.toLowerCase());
+ }
+ }
+ }
}
],
listeners: {
@@ -1802,6 +1870,7 @@
afterrender: function() {
this.boundList.on('itemdblclick', function() {
TR.util.multiselect.unselect(TR.cmp.params.dataelement.available, this);
+ TR.util.multiselect.filterSelector( TR.cmp.params.dataelement.available, Ext.getCmp('deFilterAvailable').getValue());
}, this);
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/css/style.css'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/css/style.css 2012-05-02 08:49:03 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/css/style.css 2012-05-04 08:50:53 +0000
@@ -717,3 +717,14 @@
.tr-menu-item-desc {
background-image:url('../images/hmenu-desc.gif');
}
+
+
+.tr-multiselect-filter {
+
+ -o-border-top-right-radius: 2px;
+ -icab-border-top-right-radius: 2px;
+ -khtml-border-top-right-radius: 2px;
+ -moz-border-radius-topright: 2px;
+ -webkit-border-top-right-radius: 2px;
+ border-top-right-radius: 2px;
+}