Fix checkbox bug
Change-Id: Icf6194c78bf3d124c83afb3e455d9b023775d084
This commit is contained in:
parent
f1b6d5d552
commit
aa71acef19
@ -83,6 +83,16 @@ angular.module('bansho.datasource', ['bansho.surveil'])
|
||||
|
||||
listeners[datasourceId].push(callback);
|
||||
},
|
||||
isAllCheckedTable: function (datasourceId) {
|
||||
var isAllChecked = true;
|
||||
angular.forEach(filteredData[datasourceId], function (entry) {
|
||||
if (!entry.is_checked) {
|
||||
isAllChecked = false;
|
||||
}
|
||||
});
|
||||
|
||||
return isAllChecked;
|
||||
},
|
||||
setAllCheckTable: function (datasourceId, isChecked) {
|
||||
config[datasourceId].isCheckAll = isChecked;
|
||||
angular.forEach(filteredData[datasourceId], function (entry) {
|
||||
|
@ -3,7 +3,7 @@
|
||||
<thead data-ng-repeat="head in ['moving-thead', 'static-thead']" data-ng-class="head">
|
||||
<tr>
|
||||
<th data-ng-show="checkColumn" class="data-table__checkbox">
|
||||
<md-checkbox aria-label='Check all' data-ng-model="isCheckAll" data-ng-change="onCheckChange()"></md-checkbox>
|
||||
<md-checkbox type="checkbox" aria-label='Check all' data-ng-checked="isCheckAll" data-ng-click="onClick()"></md-checkbox>
|
||||
</th>
|
||||
<th ng-repeat="column in columns" class="data-table__{{column.attributes.class}}">
|
||||
{{column.title}} <i class="ico-up-dir"></i>
|
||||
@ -13,7 +13,7 @@
|
||||
<tbody data-ng-repeat="(groupByKey, groupByItems) in entries | groupBy:'host_host_name'">
|
||||
<tr data-ng-repeat="entry in groupByItems | noRepeat:this | wrappableStyle:this">
|
||||
<td data-ng-show="checkColumn">
|
||||
<md-checkbox aria-label='Check' data-ng-model="entry.is_checked"></md-checkbox>
|
||||
<md-checkbox aria-label='Check' data-ng-model="entry.is_checked" data-ng-change="entryOnClick(entry.is_checked)"></md-checkbox>
|
||||
</td>
|
||||
<td data-ng-repeat="cell in columns"
|
||||
data-ng-click="createUrl(entry, cell.attributes)">
|
||||
|
@ -65,9 +65,14 @@ angular.module('bansho.table', ['bansho.datasource',
|
||||
}
|
||||
};
|
||||
|
||||
$scope.onCheckChange = function () {
|
||||
$scope.onClick = function () {
|
||||
$scope.isCheckAll = !$scope.isCheckAll;
|
||||
datasource.setAllCheckTable($scope.datasourceId, $scope.isCheckAll);
|
||||
};
|
||||
|
||||
$scope.entryOnClick = function () {
|
||||
$scope.isCheckAll = datasource.isAllCheckedTable($scope.datasourceId);
|
||||
};
|
||||
}]
|
||||
};
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user