gpt4 book ai didi

javascript - 如何对动态 AngularJS 表进行分页?

转载 作者:行者123 更新时间:2023-11-28 05:12:02 24 4
gpt4 key购买 nike

如何使用 ng-table-dynamic 和 $http 进行分页?

表格的 HTML 规范为

<table class="table-bonds table table-bordered table-hover table-striped"
export-csv="csv"
separator=","
show-filter="true"
ng-table-dynamic="bondsTable.bondsDataParams with bondsTable.bondsDataCols">
<tr ng-repeat="row in $data">
<td class="hand"
ng-repeat="col in $columns">{{::row.node[col.field]}}</td>
</tr>

建表代码为:

self.bondsDataParams = new NgTableParams({
page: 1, // show first page
count: 5 // count per page
}, {
filterDelay: 0,
total: 0,
getData: function (params) {
return $http(bondsDataRemote).then(function successCallback(response) {
// http://codepen.io/christianacca/pen/mJoGPE for total setting example.
params.total(response.data.nodes.length);
return response.data.nodes;
}, function errorCallback(response) {

});
}
});

AngularJS 1.5.8

最佳答案

This是一个很好的分页指令,看看它。它有很多选项并且易于使用。

关于javascript - 如何对动态 AngularJS 表进行分页?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41291005/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com