Home  >  Q&A  >  body text

java - 对已分好页的page中的list的某些项remove后,能否再重新分页?

迷茫迷茫2716 days ago498

reply all(2)I'll reply

  • 阿神

    阿神2017-04-18 10:38:28

    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.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 10:38:28

    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.

    reply
    0
  • Cancelreply