|
@@ -73,7 +73,8 @@ angular.module('luticateUtils')
|
73
|
73
|
});
|
74
|
74
|
};
|
75
|
75
|
|
76
|
|
- $scope.toggleSelectedItem = function (id) {
|
|
76
|
+ $scope.toggleSelectedItem = function (item) {
|
|
77
|
+ var id = $scope.getItemId(item);
|
77
|
78
|
var idx = $scope.selectedItems.indexOf(id);
|
78
|
79
|
if (idx > -1) {
|
79
|
80
|
$scope.selectedItems.splice(idx, 1);
|
|
@@ -90,11 +91,23 @@ angular.module('luticateUtils')
|
90
|
91
|
else {
|
91
|
92
|
$scope.selectedItems = [];
|
92
|
93
|
for (var i = 0; i < $scope.items.Data.length; ++i) {
|
93
|
|
- $scope.selectedItems.push($scope.items.Data[i].Id);
|
|
94
|
+ $scope.selectedItems.push($scope.getItemId($scope.items.Data[i]));
|
94
|
95
|
}
|
95
|
96
|
}
|
96
|
97
|
};
|
97
|
98
|
|
|
99
|
+ $scope.isItemChecked = function(item)
|
|
100
|
+ {
|
|
101
|
+ return $scope.selectedItems.indexOf($scope.getItemId(item)) > -1;
|
|
102
|
+ };
|
|
103
|
+
|
|
104
|
+ if (!$scope.getItemId) {
|
|
105
|
+ $scope.getItemId = function(item)
|
|
106
|
+ {
|
|
107
|
+ return item.Id;
|
|
108
|
+ };
|
|
109
|
+ }
|
|
110
|
+
|
98
|
111
|
$scope.loadPage($scope.page);
|
99
|
112
|
}
|
100
|
113
|
};
|
|
@@ -117,8 +130,8 @@ angular.module('luticateUtils').run(['$templateCache', function($templateCache)
|
117
|
130
|
'<tbody>' +
|
118
|
131
|
'<tr ng-repeat="item in items.Data" style="cursor: pointer" ng-click="displayItem(item)">' +
|
119
|
132
|
' <td>' +
|
120
|
|
-' <input name="selectedItems[]" type="checkbox" ng-checked="selectedItems.indexOf(item.Id) > -1"' +
|
121
|
|
- ' ng-click="$event.stopPropagation();toggleSelectedItem(item.Id)" >' +
|
|
133
|
+' <input name="selectedItems[]" type="checkbox" ng-checked="isItemChecked(item)"' +
|
|
134
|
+ ' ng-click="$event.stopPropagation();toggleSelectedItem(item)" >' +
|
122
|
135
|
' </td>' +
|
123
|
136
|
' <td ng-repeat="col in columns">{{ col.getValue(item) }}</td>' +
|
124
|
137
|
'</tr>' +
|