diff --git a/src/views/datatable/DataTableLazyDemo.vue b/src/views/datatable/DataTableLazyDemo.vue index 4e87e3477..5ba9d3177 100755 --- a/src/views/datatable/DataTableLazyDemo.vue +++ b/src/views/datatable/DataTableLazyDemo.vue @@ -2,7 +2,7 @@
-

DataTable - Lazy

+

DataTable Lazy

Lazy mode is handy to deal with large datasets, instead of loading the entire data, small chunks of data is loaded by invoking corresponding callbacks everytime paging, sorting and filtering happens. Sample belows imitates lazy paging by using an in memory list. It is also important to assign the logical number of rows to totalRecords by doing a projection query for paginator configuration so that paginator displays the UI assuming there are actually records of totalRecords size although in reality they aren't as in lazy mode, only the records that are displayed on the current page exist. @@ -12,12 +12,12 @@

- - - - - + + + +
@@ -27,52 +27,52 @@ -import CarService from '../../service/CarService'; +import CustomerService from '../../service/CustomerService'; export default { data() { return { loading: false, totalRecords: 0, - cars: null + customers: null } }, datasource: null, - carService: null, + customerService: null, created() { - this.carService = new CarService(); + this.customerService = new CustomerService(); }, mounted() { this.loading = true; setTimeout(() => { - this.carService.getCarsLarge().then(data => { + this.customerService.getCustomersLarge().then(data => { this.datasource = data; this.totalRecords = data.length, - this.cars = this.datasource.slice(0, 10); + this.customers = this.datasource.slice(0, 10); this.loading = false; }); - }, 1000); + }, 500); }, methods: { onPage(event) { this.loading = true; setTimeout(() => { - this.cars = this.datasource.slice(event.first, event.first + event.rows); + this.customers = this.datasource.slice(event.first, event.first + event.rows); this.loading = false; - }, 1000); + }, 500); } } } @@ -84,41 +84,41 @@ export default {