=== 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; };