java - 对已分好页的page中的list的某些项remove后,能否再重新分页?
迷茫
迷茫 2017-04-18 10:36:28
0
2
494
迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(2)
阿神

Pagination should be a back-end control, not a change due to front-end influence. In my project, single-page deleted items are usually completed through ajax, for example, 1-15 is deleted, 10-15 is deleted, and 16-21 is loaded.

洪涛

I don’t know if what I understand is consistent with what you expressed. I happen to be working on special paging related functions recently, so I will try to answer it.
Our usual paging page size PageSize is preset. When the total number of database records is known, the total number of pages is fixed. Therefore, when we encounter this function that requires temporary modification of the page size PageSize , there is a certain possibility that both pageNum and pageCount will change together;
What we have to do is, when a record of a certain page is removed, We need the data behind it to respond together (divided There are two types):

1. Do not change the page size
If the pageSize remains unchanged after removing the data in this page (that is, the passed list), then we have nothing to worry about, pageNum still records the last one of the current page Record, click on the previous page and next page in this way, it will not be affected. The only work that needs to be done is to display it on the front desk. The record you need to remove is indeed no longer displayed on the page. (I default that your database does not delete data. Yes, if you delete the data, that’s a different story)

2. Change the page size
If you remove the data and the page size also changes, then the following changes need to be made at the same time: pageSize, pageNum, pageCount, etc. After you remove this data, the current page size changes. Small, when the total number of data records is -1, the total number of pages needs to be recalculated: pageCount = (allCount % pageSize == 0)?(allCount/pageSize):(pallCount/pageSize + 1)

I don’t know if I have explained it clearly, I hope it can give you some help.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!