客户端分页未显示智能表

Client side pagination not showing with Smart Table

本文关键字:智能 显示 分页 客户端      更新时间:2023-09-26

问题

数据以异步方式加载并正确显示,但不会显示分页。如果你能帮忙的话,谢谢你。

HTML

<table st-safe-src="update" st-table="displayedItemList" class="table table-striped table-bordered">
    <thead>
        <tr>
            <th>Field1</th>
            <th>Field2</th>
        </tr>
    </thead>
    <tbody>
        <tr ng-repeat="item in displayedItemList">
            <td>{{item.Field1}}</td>
            <td>{{item.Field2}}</td>
        </tr>
    </tbody>
    <tfoot>
        <tr>
            <td colspan="2" class="text-center">
                <div st-pagination="" st-items-by-page="10" st-displayed-pages="7"></div>
            </td>
        </tr>
    </tfoot>
</table>

JavaScript

    $scope.itemList = [];
    $scope.displayedItemList = [];
    $scope.update = 0;
    $scope.initialize = function ()
    {
        var d = new $.Deferred();
        itemService.getItems().then(function (data) {
            $scope.itemList = data;
            $scope.displayedItemList = [].concat($scope.itemList);
            $scope.update++;
            d.resolve();
        });
        return d;
    }

尝试了替代方案

同样的结果。

    <table st-safe-src="itemList" ...

在控制器中,您需要填写st-safe-src(更新(,而不是displayedItemList.我的意思是,例如

$scope.update = $scope.itemList;