角度 NgTable 分页不起作用
Angular NgTable pagination doesn't work
我试图弄清楚我做错了什么,但找不到示例使用新版本的 NgTable
我可以从 NgTable 获取重新加载和数组,但我的分页不起作用
由于某些内容已被弃用,因此找不到处理新更改的方法。
这是与ng-table v 0.8.3
$scope.listaDetalleFactura = function () {
var idFacturaDetalle = $routeParams.idFactura;
$scope.detalleFacturas = "";
$promesa = facturaService.getDetalleFacturaList(idFacturaDetalle);
$promesa.then(function (datos) {
$scope.detalleFacturas = datos.data;
var data = datos.data;
$scope.tableParams = new NgTableParams({
page: 1,
count: 5
}, {
total: data.length,
getData: function (params) {
data = $scope.detalleFacturas;
params.total(data.length);
if (params.total() <= ((params.page() - 1) * params.count())) {
params.page(1);
}
return data.slice((params.page() - 1) * params.count(), params.page() * params.count());
}});
});
};
我的桌子:
<table ng-table="tableParams" style="margin-top: 10px;"
class="table-condensed table-bordered table-striped"
data-ng-init="listaDetalleFactura()"
>
<thead>
<tr>
<th style="width: 40px; text-align: center;">Id</th>
<th style="width: 300px;">Descripcion</th>
<th style="width: 30px; text-align: center;">Cantidad</th>
<th style="width: 150px; text-align: center;">Precio por Unidad</th>
<th style="width: 50px; text-align: center;">Descuento</th>
<th style="width: 50px; text-align: center;">Total</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="detalleFactura in detalleFacturas">
<td style="text-align: center;">{{detalleFactura.idDetalleFactura}}</td>
<td>{{detalleFactura.producto.descripcion}}</td>
<td style="width: 30px; text-align: center;">{{detalleFactura.cantidadDetalle}}</td>
<td style="width: 150px; text-align: center;">{{detalleFactura.producto.precioVenta}}</td>
<td style="width: 50px; text-align: center;">{{detalleFactura.descuentoDetalle}}</td>
<td style="width: 50px; text-align: center;">{{detalleFactura.totalDetalle}}</td>
</tr>
</tbody>
</table>
好吧,我感觉很愚蠢,对不起浪费你的时间...希望有一天这会对某人有所帮助......
我的错误在于ng-repeat
而不是detalleFacturas
我应该使用$data
<tbody>
<tr ng-repeat="detalleFactura in $data">
<td style="text-align: center;">{{detalleFactura.idDetalleFactura}}</td>
<td>{{detalleFactura.producto.descripcion}}</td>
<td style="width: 30px; text-align: center;">{{detalleFactura.cantidadDetalle}}</td>
<td style="width: 150px; text-align: center;">${{detalleFactura.producto.precioVenta}}</td>
<td style="width: 50px; text-align: center;">{{detalleFactura.descuentoDetalle}}</td>
<td style="width: 50px; text-align: center;">${{detalleFactura.totalDetalle}}</td>
</tr>
</tbody>
相关文章:
- 用键盘分页jQuery下一个和上一个控件.触发器('点击')不'不起作用
- 分页没有'当我点击javascript和php按钮时,它不起作用
- 使用jQuery在jsp中分页不起作用
- 引导分页下一个上一个不起作用
- Kendo UI网格分页不起作用
- 主干上的无限滚动/分页.js不起作用
- 分页在 AngularJS 中不起作用
- 我的js分页代码不起作用,完全不知道是什么原因造成的
- 角度UI-Grid 3.0.0-rc.16:分页对我不起作用
- ExtJS网格分页不起作用
- 角度 NgTable 分页不起作用
- XMLHttpRequest 不起作用(空白页)
- Angular js UI.bootstrap 中的分页对我不起作用
- 可脚分页在动态数据轨道上不起作用
- 数据表 jQuery 单击事件在分页后不起作用
- jquery分页在ajax加载后不起作用
- 引导表分页和搜索不起作用
- ExtJs4.1.1分页工具栏在Firefox上不起作用
- extjs6分页不起作用
- bootstrap datatable-jquery onclick函数在第2页不起作用(分页)