Smart Table Pagination链接不起作用

时间:2015-12-06 17:16:20

标签: javascript angularjs smart-table

我有以下HTML:

MyClass{
    public $str="it just works :-)";
    private function foo(){
        $obj=&$this;
        $bar=function() use(&$obj){
            echo $this->str; // it works!
        };
        $bar();
    }
}

我在控制器中有以下代码:

<table st-table="displayedCollection" 
       st-safe-src="rowCollection" 
       class="table table-striped" 
       st-pipe="callServer">
    <thead>
        <tr>
            <th st-sort="id">id</th>
            <th st-sort="name">name</th>
        </tr>
    </thead>
    <tbody ng-show="!isLoading">
        <tr ng-repeat="row in displayedCollection">
            <td>{{row.id}}</td>
            <td>{{row.name}}</td>
        </tr>
    </tbody>
    <tbody ng-show="isLoading">
        <tr>
            <td colspan="2" class="text-center">Loading ... </td>
        </tr>
    </tbody>
    <tfoot>
        <tr>
            <td class="text-center" colspan="2">
                <div 
                    st-template="templates/plugins/pagination.html" 
                    st-pagination="" 
                    st-items-by-page="10" 
                    class="ng-isolate-scope">
                </div>
            </td>
        </tr>
    </tfoot>
</table>

我低于$scope.callServer = function callServer(tableState) { var pagination = tableState.pagination; var start = pagination.start || 0; var size = pagination.number || 10; console.log('tableState:', tableState); $scope.isLoading = true; TestSuiteService.getPage(start, size, tableState).then(function (response) { $scope.rowCollection = response.results; $scope.displayedCollection = [].concat($scope.rowCollection); tableState.pagination.numberOfPages = response.numberOfPages; $scope.isLoading = false; }); };

st-template

当我点击页面时,它从服务器获取数据并将其显示在表格中,但页面未被选中。由于此上一页和最后一页链接也未显示。第1页始终保持有效状态。

1 个答案:

答案 0 :(得分:0)

我已从st-safe-src移除table属性,因此在我的情况下,我必须删除st-safe-src="rowCollection"才能使其正常工作。