Browse Source

fix(gui): Filter in m2m modal

re #337

Signed-off-by: Pranav C <61551451+pranavxc@users.noreply.github.com>
pull/341/head
Pranav C 3 years ago
parent
commit
319c230beb
  1. 23
      packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listItems.vue

23
packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listItems.vue

@ -12,8 +12,15 @@
dense dense
outlined outlined
placeholder="Search records" placeholder="Search records"
v-model="query"
class=" caption search-field ml-2" class=" caption search-field ml-2"
/> @keydown.enter="loadData"
>
<template #append>
<x-icon tooltip="Change page" small icon.class="mt-1" @click="loadData">mdi-keyboard-return
</x-icon>
</template>
</v-text-field>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-icon small class="mr-1" @click="loadData()">mdi-reload</v-icon> <v-icon small class="mr-1" @click="loadData()">mdi-reload</v-icon>
@ -99,7 +106,8 @@ export default {
}, },
data: () => ({ data: () => ({
data: null, data: null,
page: 1 page: 1,
query: ''
}), }),
mounted() { mounted() {
this.loadData(); this.loadData();
@ -108,18 +116,25 @@ export default {
async loadData() { async loadData() {
if (!this.api) return; if (!this.api) return;
let where = this.queryParams.where || '';
if (this.query){
where += (where ? '~and' : '') + `(${this.primaryCol},like,%${this.query}%)`;
}
if (this.mm) { if (this.mm) {
this.data = await this.api.paginatedM2mNotChildrenList({ this.data = await this.api.paginatedM2mNotChildrenList({
limit: this.size, limit: this.size,
offset: this.size * (this.page - 1), offset: this.size * (this.page - 1),
...this.queryParams ...this.queryParams,
where
}, this.mm.vtn, this.parentId) }, this.mm.vtn, this.parentId)
} else { } else {
this.data = await this.api.paginatedList({ this.data = await this.api.paginatedList({
limit: this.size, limit: this.size,
offset: this.size * (this.page - 1), offset: this.size * (this.page - 1),
...this.queryParams ...this.queryParams,
where
}) })
} }
} }

Loading…
Cancel
Save