Javascript 禁用智能表上的取消选择
我有一张这样的智能桌子:Javascript 禁用智能表上的取消选择,javascript,html,angularjs,smart-table,Javascript,Html,Angularjs,Smart Table,我有一张这样的智能桌子: <table id="mytable" st-safe-src="ABCSet" st-table="displayed" class="table table-responsive portlet-body panel-body"> <thead> <tr > <th >1<
<table id="mytable" st-safe-src="ABCSet" st-table="displayed" class="table table-responsive portlet-body panel-body">
<thead>
<tr >
<th >1</th>
<th >2</th>
<th >3</th>
</tr>
</thead>
<tbody data-ng-dblclick="scrollTo()">
<tr data-ng-repeat="row in displayed" st-select-row="row" st-select-mode="single">
<td data-ng-click="$parent.selR(row);">{{row.randomP.randomD}}</td>
<td data-ng-click="$parent.selR(row);">{{row.randomP.randomD}}</td>
<td data-ng-click="$parent.selR(row);">{{row.randomP.randomD}}</td>
</tr>
</tbody>
</table>
1.
2.
3.
{{row.randomP.randomD}
{{row.randomP.randomD}
{{row.randomP.randomD}
它工作正常,但我在表下的一些标签上显示了数据,因此我想在用户单击当前选定行时禁用取消选择(正如您所看到的,我对滚动事件使用双击,因此在调用选定行时取消选择该行非常奇怪)。您可以使用ng watch进行此操作
// get selected row
$scope.selectedId = 0;
// fired when table rows are selected
$scope.$watch('displayedCollection', function (row) {
row.filter(function (r) {
if (r.isSelected && r.id != $scope.selectedId) {
$scope.selectedId = r.id;
getInfo(r.id);
}
else{
$scope.selectedId = r.id;
}
})
}, true);
我需要同样的东西。