Skip to content

Commit f95e7eb

Browse files
POC: test datatable inside division
Issue: BMS-5187 / BMS-5188 / BMS-5189 Reviewer: None
1 parent 4d12c3b commit f95e7eb

File tree

4 files changed

+39
-7
lines changed

4 files changed

+39
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<div class="row" ng-cloak="">
22
<div class="col-xs-12">
33
<h1>Division title: {{division.name}}</h1>
4+
<div>
5+
<button ng-click="addDataTable()">addDataTable</button>
6+
<table id="subobservation-table-{{subObservation.id}}-{{division.id}}" width="100%"
7+
class="table-curved table-condensed">
8+
</table>
9+
</div>
410
</div>
511
</div>

src/main/webapp/WEB-INF/static/js/trialmanager/manageTrial.js

+5
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ stockListImportNotSaved, ImportDesign, isOpenStudy, displayAdvanceList, Inventor
9999
params: {
100100
subObservation: null
101101
},
102+
resolve: {
103+
subObservation: ['$stateParams', function ($stateParams) {
104+
return $stateParams.subObservation;
105+
}]
106+
},
102107
sticky: true
103108
})
104109
.state('subobservations.division', {
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,39 @@
1-
/*global angular*/
2-
31
(function () {
42
'use strict';
53

64
var manageTrialApp = angular.module('manageTrialApp');
75

8-
manageTrialApp.controller('SubObservationDivisionCtrl', ['$scope', 'TrialManagerDataService', '$stateParams',
9-
function ($scope, TrialManagerDataService, $stateParams) {
6+
manageTrialApp.controller('SubObservationDivisionCtrl', ['$scope', 'TrialManagerDataService', '$stateParams'/*, 'subObservation'*/,
7+
function ($scope, TrialManagerDataService, $stateParams/*, subObservation*/) {
108

119
$scope.division = $stateParams.division;
10+
// $scope.subObservation = subObservation;
11+
12+
$scope.addDataTable = function () {
13+
14+
// for testing
15+
var tableIdentifier = '#subobservation-table-' + $scope.subObservation.id + '-' + $scope.division.id;
16+
new BMS.Fieldbook.MeasurementsDataTable(tableIdentifier);
1217

13-
// TODO lazy load content
18+
/*
19+
TODO
20+
new DataTable({
21+
tableIdentifier: 'subobservation-table-' + subObservation.id + '-' + division.id
22+
})
23+
*/
24+
}
1425
}]);
1526

27+
// TODO
28+
function DataTable(options) {
29+
var tableIdentifier = options.tableIdentifier;
30+
31+
// recreate a table if exists
32+
if ($(tableIdentifier).html() && !!$(tableIdentifier).html().trim()) {
33+
$(tableIdentifier).dataTable().fnDestroy();
34+
$(tableIdentifier).empty();
35+
}
36+
37+
38+
}
1639
})();

src/main/webapp/WEB-INF/static/js/trialmanager/subobservations/subobservations.js

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
$scope.subObservation = $stateParams.subObservation;
1212
$scope.title = $scope.subObservation.name;
1313

14-
// TODO lazy load content
15-
1614
}]);
1715

1816
})();

0 commit comments

Comments
 (0)