This commit is contained in:
2018-11-21 23:54:23 +00:00
parent 573ea79dde
commit 1a0f0fe207

View File

@@ -35,7 +35,6 @@ export default {
{
text: "Widget",
align: "left",
sortable: false,
value: "name"
},
{ text: "Serial", value: "serial" },
@@ -49,22 +48,33 @@ export default {
watch: {
pagination: {
handler() {
this.getDataFromApi().then(data => {
this.Items = data.items;
this.totalItems = data.total;
});
this.getDataFromApi();
/*
{
descending: false,
page: 1,
rowsPerPage: 5,
sortBy: "name",
totalItems: 0
}
*/
// this.getDataFromApi().then(data => {
// this.Items = data.items;
// this.totalItems = data.total;
// });
},
deep: true
}
},
mounted() {
this.loading = true;
pagedList.fetch("Widget/ListWidgets", { Offset: 5, Limit: 5 }).then(res => {
// debugger;
this.loading = false;
this.Items = res.data;
this.totalItems = res.paging.count;
});
this.getDataFromApi();
// this.loading = true;
// pagedList.fetch("Widget/ListWidgets", { Offset: 5, Limit: 5 }).then(res => {
// // debugger;
// this.loading = false;
// this.Items = res.data;
// this.totalItems = res.paging.count;
// });
// this.getDataFromApi().then(data => {
// this.Items = data.items;
@@ -72,6 +82,32 @@ export default {
// });
},
methods: {
getDataFromApi() {
var listOptions = {
Offset: 0,
Limit: 5
};
if (this.pagination.rowsPerPage) {
listOptions.Limit = this.pagination.rowsPerPage;
}
if (this.pagination.page) {
if (this.pagination.page > 0) {
listOptions.Offset = this.pagination.page * listOptions.Limit;
} else {
listOptions.Offset = 0;
}
}
this.loading = true;
pagedList.fetch("Widget/ListWidgets", listOptions).then(res => {
// debugger;
this.loading = false;
this.Items = res.data;
this.totalItems = res.paging.count;
});
}
// getDataFromApi() {
// //http://localhost:7575/api/v8.0/Widget/ListWidgets?Offset=5&Limit=5
// this.loading = true;