我正在使用smart-table显示一个包含员工姓名、分机等的表。我的数据加载得很好,但是当我尝试使用st-sort进行排序时,它只对行的上半部分进行排序。总是一半,总是最高的。
下面是表格的html代码片段:
<div class="col8" ng-controller="employeeCtrl">
<table st-table="employeesCollection" st-safe-src="employeesCollection" class="table table-striped">
<thead>
<tr>
<th st-sort="firstName" st-skip-natural="true">First Name</th>
<th st-sort="lastName" st-skip-natural="true">Last Name</th>
<th st-sort="extension" st-skip-natural="true">Extension</th>
<th st-sort="city" st-skip-natural="true">Store City</th>
<th st-sort="number" st-skip-natural="true">Store Number</th>
</tr>
<tr>
<td>
<input type="text" id="FirstName" size="10" ng-keyup="searchEmp()" /></td>
<td>
<input type="text" id="LastName" size="10" ng-keyup="searchEmp()" /></td>
<td>
<input type="text" id="Extension" size="10" ng-keyup="searchEmp()" /></td>
<td>
<select id="store" onchange="searchEmp()">
<option value=''>Select City</option>
<% For Each city In cityList%>
<option value="<%=city%>"><%=city%></option>
<% Next%>
</select></td>
<td>
<select id="storeNo" onchange="searchEmp()">
<option value=''>Select Store</option>
<% For Each store In storeList%>
<option value="<%=store%>"><%=store%></option>
<% Next%>
</select>
</td>
</tr>
</thead>
<tbody>
<tr ng-repeat="employee in employeesCollection">
<td ng-repeat="col in employee track by $index">{{col}}</td>
</tr>
</tbody>
</table>
</div>有人有什么想法吗?
发布于 2015-12-11 06:05:51
我注意到的一件事,可能是问题所在,您在st-table指令和st-safe-src指令中使用了相同的集合。如果您使用的是异步数据,则需要按照文档中的方式进行设置:
st-table="displayedCollection" st-safe-src="rowCollection"在你的控制器中:
$scope.displayedCollection = [].concat($scope.rowCollection);https://stackoverflow.com/questions/34212448
复制相似问题