Add delay

pull/938/head
Cagatay Civici 2021-02-02 17:40:49 +03:00
parent 18f6307ab7
commit 8636b1ee6d
1 changed files with 21 additions and 16 deletions

View File

@ -46,7 +46,6 @@
</div>
<pre v-code>
<code><template v-pre>
&lt;DataTable :value="customers" :lazy="true" :paginator="true" :rows="10" :filters="filters" ref="dt"
&lt;DataTable :value="customers" :lazy="true" :paginator="true" :rows="10" :filters="filters" ref="dt"
:totalRecords="totalRecords" :loading="loading" @page="onPage($event)" @sort="onSort($event)"&gt;
&lt;Column field="name" header="Name" filterMatchMode="startsWith" ref="name" :sortable="true"&gt;
@ -119,11 +118,13 @@ export default {
loadLazyData() {
this.loading = true;
setTimeout(() => {
this.customerService.getCustomers({lazyEvent: JSON.stringify( this.lazyParams )}).then(data => {
this.customers = data.customers;
this.totalRecords = data.totalRecords;
this.loading = false;
});
}, Math.random() * 1000 + 250);
},
onPage(event) {
this.lazyParams = event;
@ -252,11 +253,13 @@ export default {
loadLazyData() {
this.loading = true;
setTimeout(() => {
this.customerService.getCustomers({lazyEvent: JSON.stringify( this.lazyParams )}).then(data => {
this.customers = data.customers;
this.totalRecords = data.totalRecords;
this.loading = false;
});
}, Math.random() * 1000 + 250);
},
onPage(event) {
this.lazyParams = event;
@ -298,11 +301,13 @@ export default {
loadLazyData() {
this.loading = true;
setTimeout(() => {
this.customerService.getCustomers({lazyEvent: JSON.stringify( this.lazyParams )}).then(data => {
this.customers = data.customers;
this.totalRecords = data.totalRecords;
this.loading = false;
});
}, Math.random() * 1000 + 250);
},
onPage(event) {
this.lazyParams = event;