我正在使用primeng表,并为其启用了分页。我正在尝试向用户显示当前显示的记录的计数和总记录。类似于显示200条条目中的1-20条。然而,这样做的问题是,如果记录不是20的倍数,则最后一页显示194个条目中的180到200个条目。我希望它是194个条目中的180到194个。请帮帮忙。提前谢谢。
这是我的模板
<ng-template pTemplate="paginatorleft" let-state>
<span>Showing {{(state.page * state.rows) + 1}} to {{state.rows * (state.page + 1)}} of {{state.totalRecords}} entries
</ng-template>发布于 2020-05-13 14:07:29
为什么不直接更新条件呢?
(state.totalRecords > (state.rows * (state.page + 1))) ? state.rows * (state.page + 1) : state.totalRecords代替
state.rows * (state.page + 1)https://stackoverflow.com/questions/61767471
复制相似问题