Angularjs 清除表行分页上的css类
我有一张有页码的智能桌子。我有一个将css类应用于所选行的控制器。所以问题是它会在其他页面的索引上保留所选内容,所以我正在寻找一种在使用或单击分页时清除类的方法 这是表格:Angularjs 清除表行分页上的css类,angularjs,pagination,smart-table,Angularjs,Pagination,Smart Table,我有一张有页码的智能桌子。我有一个将css类应用于所选行的控制器。所以问题是它会在其他页面的索引上保留所选内容,所以我正在寻找一种在使用或单击分页时清除类的方法 这是表格: <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <div ng-app="myApp" ng-controller="TestCtrl"> <d
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="myApp" ng-controller="TestCtrl">
<div class="smart-table-container">
<table id="mytable" st-safe-src="dataSet" st-table="displayed" class="smart-table table">
<thead>
<tr >
<th >A COLUMN</th>
<th >A COLUMN</th>
<th >A COLUMN</th>
<th >A COLUMN</th>
<th >A COLUMN</th>
</tr>
</thead>
<tbody data-ng-dblclick="scrollTo()">
<tr data-ng-repeat="row in displayed" st-select-row="row" st-select-mode="single" data-ng-click="$parent.setClickedRow($index)" and data-ng-class="{'selected':$index == $parent.selectedRow}">
<td data-ng-click="$parent.selData(row);">{{$index}}</td>
<td data-ng-click="$parent.selData(row);">{{row.asd}}</td>
<td data-ng-click="$parent.selData(row);">{{row.dsa}}</td>
<td data-ng-click="$parent.selData(row);">{{row.qwe}}</td>
<td data-ng-click="$parent.selData(row);">{{row.ewq}}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td class="text-center" st-pagination="" st-items-by-page="5" colspan="8">
</td>
</tr>
</tfoot>
</table>
</div>
</div>
和css类:
.selected {
background-color: #67BBED;
}
将其包含在控制器中可能会起作用
$scope.$watch('displayed', function() {
$scope.selectedRow = null;
});
提供一个最简单的工作示例:)已编辑,现在可以使用,但由于企业原因,我无法发布
$scope.$watch('displayed', function() {
$scope.selectedRow = null;
});