-
-
Notifications
You must be signed in to change notification settings - Fork 723
Description
Hey, when using sst, the first page populates the data to the table correctly, but when I go to another page, after I replace the old data with the new data at the setTable method table tells me no records, while when I console.log the data is coming back correctly. What might be the issue?
`<vs-table
:sst="true"
@search="handleSearch"
@change-page="handleChangePage"
@sort="handleSort"
v-model="selected"
pagination
max-items="3"
:total="table.totalElements"
search
:data="data">
<template slot="thead">
<vs-th v-for="(headerItem,n) in headers" :key="n">{{$t(headerItem.label)}}</vs-th>
</template>
<template slot-scope="{data}">
<vs-tr :data="tr" :key="indextr" v-for="(tr, indextr) in data" >
<vs-td v-for="(rowItem, r) in headers" :key="r" :data="data[indextr]+'.'+rowItem.key">
{{data[indextr][rowItem.key]}}
</vs-td>
</vs-tr>
</template>
</vs-table>`
`export default{
data:() => ({
selected:[],
data:[],
table: {
direction: 'DESC',
orderBy: 'id',
page: 0,
size: 3,
totalElements: 0,
},
headers:[
{
key: 'name',
label: 'tableName',
},
{
key: 'description',
label: 'tableDescription',
},
{
key: 'unitValue',
label:'tableUnitValue' ,
},
{
key: 'parentProduct',
label:'tableParentProduct' ,
},
{
key: 'productType',
label:'tableProductType' ,
},
{
key: 'category',
label: 'tableCategory'
},
{
key: 'dateCreated',
label: 'tableDateCreated'
}
]
}),
methods:{
handleChangePage (page) {
this.table.page = page - 1;
this.setTable();
},
setTable(){
this.get(this.url,this.table).then((response)=>{
this.data = response.data;
this.table.totalElements = response.totalElements;
console.log(JSON.stringify(this.data))
//DATA CHANGES BUT TABLE DATE GOES TO BLANK
})
}
}
}`