OneWayTech / vue2-datatable

(DEPRECATED) The best Datatable for Vue.js 2.x which never sucks. Give us a star 🌟 if you like it!
MIT License
881 stars 230 forks source link

Pagination not reducing table content #37

Closed chibuzoro closed 6 years ago

chibuzoro commented 6 years ago

I'm unable to get pagination working. the docs don't explain much to my understanding. I have datatables loaded as per documentation. using the advanced code example. Now footer appears to have pagination displayed and it responds to page select. However, the data on the table does not. I have 31 rows on the table, after switching page select to 5, table doesn't get limited to 5 rows.

i'm using Vue 2.5.3 vue2-datatable 2.1.18

kenberkeley commented 6 years ago

screenshot?

kenberkeley commented 6 years ago

rows displayed are only according to data

chibuzoro commented 6 years ago

screen shot 2017-11-16 at 4 55 41 pm

kenberkeley commented 6 years ago

this.query.limit is 5 does not mean this.data.length is 5

kenberkeley commented 6 years ago

you have to control this.data to display

chibuzoro commented 6 years ago

as seen on the screenshot i'm expecting the table data displayed to be reduced to 5 per page.. but it just stays the same.. what do i need to do to achieve the desired effect as displayed in the example

kenberkeley commented 6 years ago

your backend API should return 5 rows according to query.limit === 5

chibuzoro commented 6 years ago

ooh i need to do another server query for the pagination to work?

kenberkeley commented 6 years ago

if API outputs all the rows, you have to control the display yourself. e.g.

this.data = rows.slice(this.query.offset, this.query.offset + this.query.limit)
chibuzoro commented 6 years ago

i thought like datatables.net this is meant to be an option. that is.. once the data is pulled from the server, the table can limit its display

kenberkeley commented 6 years ago

noop buddy... it's different

kenberkeley commented 6 years ago

if there are 10000000000+ rows, your page stucks!

chibuzoro commented 6 years ago

so how do i deal with page changes using this approach.. its not clear to me how to customize the behavior and positioning of the elements... going by your example. i already limit returned rows to 100 from the server.. i just want the pagination to split them as needed..

kenberkeley commented 6 years ago

that is a front-end pagination... not a common one...

kenberkeley commented 6 years ago

as I said, split it your self:

this.data = rows.slice(this.query.offset, this.query.offset + this.query.limit)
kenberkeley commented 6 years ago

also: this.query.total = 100

chibuzoro commented 6 years ago

ok

kenberkeley commented 6 years ago

your scenario is so strange, lol

chibuzoro commented 6 years ago

maybe id raise a new issue about how to reposition the elements.. e.g remove page-select from the footer and on to the top. also how to change the icon fonts used for sorting... looks like i have to rewrite the index of the datatable just to achive this

chibuzoro commented 6 years ago

Thanks for the help..

kenberkeley commented 6 years ago

you're welcome to DIY