From 34efc5a87152c92807860dcdc08f8ae3abb151dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Wed, 20 Jan 2021 13:24:50 +0300 Subject: [PATCH] fix enter event for LazyLoad Demo --- src/views/datatable/DataTableLazyDemo.vue | 27 +++++++++++------------ 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/views/datatable/DataTableLazyDemo.vue b/src/views/datatable/DataTableLazyDemo.vue index 79ea506ae..83c0442ef 100755 --- a/src/views/datatable/DataTableLazyDemo.vue +++ b/src/views/datatable/DataTableLazyDemo.vue @@ -16,22 +16,22 @@ :totalRecords="totalRecords" :loading="loading" @page="onPage($event)" @sort="onSort($event)"> @@ -48,22 +48,22 @@ :totalRecords="totalRecords" :loading="loading" @page="onPage($event)" @sort="onSort($event)"> <Column field="name" header="Name" filterMatchMode="startsWith" ref="name" :sortable="true"> <template #filter> - <InputText type="text" v-model="filters['name']['value']" @keydown="onFilter($event)" class="p-column-filter" placeholder="Search by name"/> + <InputText type="text" v-model="filters['name']['value']" @keydown.enter="onFilter($event)" class="p-column-filter" placeholder="Search by name"/> </template> </Column> <Column field="country.name" header="Country" filterField="country.name" filterMatchMode="contains" ref="country.name" :sortable="true"> <template #filter> - <InputText type="text" v-model="filters['country.name']['value']" @keydown="onFilter($event)" class="p-column-filter" placeholder="Search by country"/> + <InputText type="text" v-model="filters['country.name']['value']" @keydown.enter="onFilter($event)" class="p-column-filter" placeholder="Search by country"/> </template> </Column> <Column field="company" header="Company" filterMatchMode="contains" ref="company" :sortable="true"> <template #filter> - <InputText type="text" v-model="filters['company']['value']" @keydown="onFilter($event)" class="p-column-filter" placeholder="Search by company"/> + <InputText type="text" v-model="filters['company']['value']" @keydown.enter="onFilter($event)" class="p-column-filter" placeholder="Search by company"/> </template> </Column> <Column field="representative.name" header="Representative" filterField="representative.name" ref="representative.name" :sortable="true"> <template #filter> - <InputText type="text" v-model="filters['representative.name']['value']" @keydown="onFilter($event)" class="p-column-filter" placeholder="Search by representative"/> + <InputText type="text" v-model="filters['representative.name']['value']" @keydown.enter="onFilter($event)" class="p-column-filter" placeholder="Search by representative"/> </template> </Column> </DataTable> @@ -207,15 +207,14 @@ export default { this.loadLazyData(); }, onSort(event) { + console.log(event) this.lazyParams = event; this.loadLazyData(); }, - onFilter(event) { - if (event.keyCode === 13) { - this.loading = true; - this.lazyParams.filters = this.filters; - this.loadLazyData(); - } + onFilter() { + this.loading = true; + this.lazyParams.filters = this.filters; + this.loadLazyData(); } } }