@@ -7,21 +7,20 @@ function RowSelect($compile, $scope, $resource, DTOptionsBuilder, DTColumnBuilde
7
7
vm . selected = { } ;
8
8
vm . selectAll = false ;
9
9
vm . toggleAll = toggleAll ;
10
- vm . toggleOne = toggleOne ;
11
10
12
11
var titleHtml = '<input type="checkbox" ng-model="showCase.selectAll"' +
13
12
'ng-click="showCase.toggleAll(showCase.selectAll, showCase.selected)">' ;
14
13
15
14
vm . dtOptions = DTOptionsBuilder . fromFnPromise ( function ( ) {
16
- return $resource ( 'data1.json' ) . query ( ) . $promise ;
17
- } )
15
+ return $resource ( 'data1.json' ) . query ( ) . $promise ;
16
+ } )
18
17
. withOption ( 'createdRow' , function ( row , data , dataIndex ) {
19
18
// Recompiling so we can bind Angular directive to the DT
20
19
$compile ( angular . element ( row ) . contents ( ) ) ( $scope ) ;
21
20
} )
22
21
. withOption ( 'headerCallback' , function ( header ) {
23
22
if ( ! $scope . headerCompiled ) {
24
- //use this headerCompiled field to only compile header once
23
+ // Use this headerCompiled field to only compile header once
25
24
$scope . headerCompiled = true ;
26
25
$compile ( angular . element ( header ) . contents ( ) ) ( $scope ) ;
27
26
}
@@ -31,8 +30,7 @@ function RowSelect($compile, $scope, $resource, DTOptionsBuilder, DTColumnBuilde
31
30
DTColumnBuilder . newColumn ( null ) . withTitle ( titleHtml ) . notSortable ( )
32
31
. renderWith ( function ( data , type , full , meta ) {
33
32
vm . selected [ full . id ] = false ;
34
- return '<input type="checkbox" ng-model="showCase.selected[' + data . id + ']"' +
35
- 'ng-click="showCase.toggleOne(showCase.selected)"/>' ;
33
+ return '<input type="checkbox" ng-model="showCase.selected[' + data . id + ']"/>' ;
36
34
} ) ,
37
35
DTColumnBuilder . newColumn ( 'id' ) . withTitle ( 'ID' ) ,
38
36
DTColumnBuilder . newColumn ( 'firstName' ) . withTitle ( 'First name' ) ,
@@ -51,18 +49,5 @@ function RowSelect($compile, $scope, $resource, DTOptionsBuilder, DTColumnBuilde
51
49
selectedItems [ id ] = selectAll ;
52
50
}
53
51
}
54
- } ;
55
-
56
- function toggleOne ( selectedItems ) {
57
- var me = this ;
58
- for ( var id in selectedItems ) {
59
- if ( selectedItems . hasOwnProperty ( id ) ) {
60
- if ( ! selectedItems [ id ] ) {
61
- me . selectAll = false ;
62
- return ;
63
- }
64
- }
65
- }
66
- me . selectAll = true ;
67
- } ;
52
+ }
68
53
}
0 commit comments