ratiw / vue-table

data table simplify! -- vuetable is a Vue.js component that will automatically request (JSON) data from the server and display them nicely in html table with swappable/extensible pagination component.
MIT License
1.83k stars 303 forks source link

Pagination is not being displayed #168

Closed yusupprog closed 6 years ago

yusupprog commented 6 years ago

Hi. Can't make pagination work

Here's my vue template

<template>
    <div>
        <vuetable 
                  :reactive-api-url="true"
                  :api-url="here-valid-url"
                  :fields="['id', 'name', 'email']"
                  :per-page="1"
        />
        <vuetable-pagination ref="pagination"/>
    </div>
</template>

here's my response from server

{  
   "data":[  
      {  
         "id":3,
         "name":"Test",
         "email":"test@test.test",
         "phone":"phone",
      }
   ],
   "links":{  
      "pagination":{  
         "total":2,
         "per_page":1,
         "current_page":1,
         "last_page":2,
         "from":1,
         "to":2
      }
   }
}

Pagination isn't even being appeared. Please help. By the way very nice package! Like it Thanks!

ratiw commented 6 years ago

@yusupprog Which version of Vuetable you're using? vue-table or vuetable-2??

yusupprog commented 6 years ago

vuetable-2

ratiw commented 6 years ago

You're posing in a wrong repo. Please go through the tutorial first. There's some differences between vue-table and vuetable-2.

yusupprog commented 6 years ago

I think I went through all tutorials and documentation related to pagination. Could't make it work. Can you just tell me what is wrong in my code?

yusupprog commented 6 years ago
methods: {
    //...
    onPaginationData (paginationData) {
      this.$refs.pagination.setPaginationData(paginationData)
    },
    onChangePage (page) {
      this.$refs.vuetable.changePage(page)
    }
  }

I think i missed that Right?

ratiw commented 6 years ago

At see see this one.

yusupprog commented 6 years ago

OK. Just missed event listening Thanks.

methods: {
    //...
    onPaginationData (paginationData) {
      this.$refs.pagination.setPaginationData(paginationData)
    },
    onChangePage (page) {
      this.$refs.vuetable.changePage(page)
    }
  }