dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30242
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15340: by default display only those attributes marked displayInListNoProgram
------------------------------------------------------------
revno: 15340
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Wed 2014-05-21 18:21:54 +0200
message:
by default display only those attributes marked displayInListNoProgram
modified:
dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.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-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js 2014-05-21 16:13:41 +0000
+++ dhis-2/dhis-web/dhis-web-tracker-capture/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js 2014-05-21 16:21:54 +0000
@@ -62,8 +62,6 @@
TranslationService.translate();
$scope.loadPrograms($scope.selectedOrgUnit);
$scope.search($scope.searchMode.listAll);
-
- console.log('hi there...');
}
});
@@ -160,7 +158,7 @@
$scope.trackedEntityList = data;
if($scope.trackedEntityList){
- $scope.gridColumns = $scope.generateGridColumns($scope.trackedEntityList.headers);
+ $scope.gridColumns = $scope.generateGridColumns($scope.attributes);
}
});
@@ -169,31 +167,22 @@
//generate grid columns from teilist attributes
$scope.generateGridColumns = function(attributes){
var columns = angular.copy(attributes);
- var defaultColumnSize = 5;
- var index = 0;
-
+
//also add extra columns which are not part of attributes (orgunit for example)
- columns.push({id: 'orgUnitName', name: 'Organisation unit', type: 'string'});
+ columns.push({id: 'orgUnitName', name: 'Organisation unit', type: 'string', displayInListNoProgram: false});
//generate grid column for the selected program/attributes
angular.forEach(columns, function(column){
-
if(column.id === 'orgUnitName' && $scope.ouMode.name === 'SELECTED'){
column.show = false;
}
- else{
- if(index < defaultColumnSize){
- column.show = true;
- }
- else{
- column.show = false;
- }
- }
+ if(column.displayInListNoProgram){
+ column.show = true;
+ }
if(column.type === 'date'){
$scope.filterText[column.id]= {start: '', end: ''};
}
- index++;
});
return columns;
};