Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Pagination And Insert

$
0
0
Facing with glitch of pagination
Let us imagine that we have configured view model and controller of news.
We havent pagination list (1,2,3,4,>,< etc) on page, but we have jquery callback at the end of page, which loads next page with limit of 5 news with DESC order by create_time.
we have 11 news.
in standart way it will add var $page to $_GET and works fine.

BUT!

1) user loads 1-st page he see:
row11
row10
row9
row8
row7

2) admin adds new row12 at news

3) user loads page 2 to the end of page.
Pagination adds limit 5 and offset 5 to sql, and page1 is row{12-8} so he will see:
row11
row10
row9
row8
row7
row7
row6
row5
row4
row3

so the row7 will be shown twice.

As I see the solution is to send last id as offset.
but how to convert last id to real offset?

I will post part of code if you will request it. Its a bit huge with jquery abd a lot of conditions, so ask me what do you what to see

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>