通過使用角度智能表,我如何通過使用偏移值來獲得結果集。 例如,我在數據庫使用智能表的angularjs分頁
- 首先我需要從數據庫中獲得20條記錄,並在每頁上顯示只有10個項目100個記錄。
- 點擊第三頁之後,需要查詢數據庫(服務電話),並獲得另外20 records..etc(但不包括服務器徵集第2頁)
我使用智能表管/ AJAX插件來顯示記錄。
如何使用這個來實現。
<div class="table-container" ng-controller="pipeCtrl as mc">
<table class="table" st-pipe="mc.callServer" st-table="mc.displayed">
<thead>
<tr>
<th st-sort="id">id</th>
<th st-sort-default="reverse" st-sort="name">name</th>
<th st-sort="age">age</th>
<th st-sort="saved">saved people</th>
</tr>
<tr>
<th><input st-search="id"/></th>
<th><input st-search="name"/></th>
<th><input st-search="age"/></th>
<th><input st-search="saved"/></th>
</tr>
</thead>
<tbody ng-show="!mc.isLoading">
<tr ng-repeat="row in mc.displayed">
<td>{{row.id}}</td>
<td>{{row.name}}</td>
<td>{{row.age}}</td>
<td>{{row.saved}}</td>
</tr>
</tbody>
<tbody ng-show="mc.isLoading">
<tr>
<td colspan="4" class="text-center"><div class="loading-indicator"></div>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td class="text-center" st-pagination="" st-items-by-page="5" colspan="4">
</td>
</tr>
</tfoot>
</table>
</div>
http://lorenzofox3.github.io/smart-table-website/
代碼在Plunker
http://plnkr.co/edit/wzUHcc9PBF6tzH8iAEsn?p=preview