dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14313
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4822: Orgunit root selected by default.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 4822 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-10-04 12:24:19 +0200
message:
Orgunit root selected by default.
modified:
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/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-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js 2011-10-03 15:17:06 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js 2011-10-04 10:22:17 +0000
@@ -210,7 +210,11 @@
organisationunit: {
getUrl: function(isFilter) {
var a = [],
- selection = DV.util.getCmp('treepanel').getSelectionModel().getSelection();
+ treepanel = DV.util.getCmp('treepanel'),
+ selection = treepanel.getSelectionModel().getSelection();
+ if (!selection.length) {
+ selection = [treepanel.getRootNode()];
+ }
Ext.Array.each(selection, function(r) {
a.push('organisationUnitIds=' + r.data.id);
});
@@ -218,7 +222,11 @@
},
getNames: function() {
var a = [],
- selection = DV.util.getCmp('treepanel').getSelectionModel().getSelection();
+ treepanel = DV.util.getCmp('treepanel'),
+ selection = treepanel.getSelectionModel().getSelection();
+ if (!selection.length) {
+ selection = [treepanel.getRootNode()];
+ }
Ext.Array.each(selection, function(r) {
a.push(r.data.text);
});
@@ -1161,6 +1169,11 @@
width: DV.conf.layout.west_cmp_width,
autoScroll: true,
multiSelect: true,
+ selectRoot: function() {
+ if (!this.getSelectionModel().getSelection().length) {
+ this.getSelectionModel().select(this.getRootNode());
+ }
+ },
store: Ext.create('Ext.data.TreeStore', {
proxy: {
type: 'ajax',
@@ -1173,17 +1186,16 @@
}
}),
listeners: {
- //afterrender: function(tp) {
- //tp.getRootNode()
itemcontextmenu: function(a,b,c,d,e) {
- console.log(e);
+ //console.log(e);
}
}
}
],
listeners: {
- expand: function() {
+ expand: function(fs) {
DV.util.fieldset.collapseOthers(this.name);
+ fs.down('treepanel').selectRoot();
}
}
}