【发布时间】:2017-12-08 00:23:27
【问题描述】:
我正在使用智能表。我有一个逻辑,我只需要选择一个项目。我当前的表格代码允许选择多行。
这是我的 HTML:
<table st-safe-src="flow3.dataSet" st-table="flow3.displayed" class="table table-striped">
<thead>
<tr>
<th st-sort="method">Method</th>
<th st-sort="sample">Sample</th>
<th st-sort="parameters">Parameters</th>
</tr>
</thead>
<tbody ui-sortable ng-model="flow3.displayed">
<tr ng-repeat="row in flow3.displayed track by $index" style="cursor: move;" ng-click="row.selected = !row.selected; flow3.selectRow($event, row)" ng-class="{success: row.selected}">
<td>{{row.method.name}}</td>
<td>{{row.sample}}</td>
<td>
<span ng-repeat="parameter in row.parameters">{{parameter.methodInputParameter.name}} : {{parameter.value}}<br/></span>
</td>
<td>
<button type="button" ng-click="flow3.removeItem(row)"
class="btn btn-danger btn-sm btn-round pull-right"
ng-disabled="flow3.confirmDisabled">
<i class="glyphicon glyphicon-trash"></i>
</button>
</td>
</tr>
</tbody>
</table>
这是我的 JS:
flow3.selectRow = function($event, row) {
flow3.selectedItem = row;
}
【问题讨论】:
-
您只是想应用不同的类来突出显示该行吗?
-
嗨斯坦尼斯拉夫。突出显示的行的类无关紧要。我只是不能同时选择 2 行
标签: angularjs html-table angular-ui-bootstrap smart-table