4

问题

数据异步加载并正确显示,但不出现分页。如果你能帮忙,谢谢。

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" ...
4

1 回答 1

0

in the controller, you need to fill in the st-safe-src (update), not displayedItemList. I mean, for example

$scope.update = $scope.itemList; 
于 2017-01-26T16:54:24.457 回答