table search
This commit is contained in:
parent
d59aa8cf0d
commit
038582b454
@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="My-Input">
|
<div class="My-Input">
|
||||||
<label>{{ label }}</label>
|
<label>{{ label }}</label>
|
||||||
<input type="text" v-if="type == 'text'" v-model="currentValue" @blur="validate()">
|
<input type="text" v-if="type == 'text'" v-model="currentValue" @blur="validate()" @change="() => $emit('change', currentValue)">
|
||||||
<input type="password" v-else-if="type == 'password'" v-model="currentValue" @blur="validate()">
|
<input type="password" v-else-if="type == 'password'" v-model="currentValue" @blur="validate()" @change="() => $emit('change', currentValue)">
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="Scroll-Table">
|
<div class="Scroll-Table">
|
||||||
|
<my-input label="Suche:" type="text" @change="searchChanged" v-model="currentSearch"></my-input>
|
||||||
<my-table :columns="columns" :rows="rows" @sort="sort"></my-table>
|
<my-table :columns="columns" :rows="rows" @sort="sort"></my-table>
|
||||||
<div v-if="loadingDelayed">loading...</div>
|
<div v-if="loadingDelayed">loading...</div>
|
||||||
<div style="padding-left: 30%; padding-bottom: 100px;">
|
<div style="padding-left: 30%; padding-bottom: 100px;">
|
||||||
<span v-show="hasMore || sortTriggered" v-if="!loadingDelayed" v-observe-visibility="visibilityChanged">...</span>
|
<span v-show="hasMore || reloadTriggered" v-if="!loadingDelayed" v-observe-visibility="visibilityChanged">...</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MyTable from './my-table.vue';
|
import MyTable from './my-table.vue';
|
||||||
|
import MyInput from './my-input.vue';
|
||||||
|
|
||||||
import { ObserveVisibility } from 'vue-observe-visibility/dist/vue-observe-visibility';
|
import { ObserveVisibility } from 'vue-observe-visibility/dist/vue-observe-visibility';
|
||||||
|
|
||||||
@ -19,7 +21,8 @@ export default {
|
|||||||
ObserveVisibility
|
ObserveVisibility
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
MyTable
|
MyTable,
|
||||||
|
MyInput
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
columns: {
|
columns: {
|
||||||
@ -49,6 +52,9 @@ export default {
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
|
search: {
|
||||||
|
type: String
|
||||||
|
},
|
||||||
loading: {
|
loading: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
@ -88,16 +94,17 @@ export default {
|
|||||||
currentOffset: this.offset,
|
currentOffset: this.offset,
|
||||||
currentOrderBy: this.orderBy,
|
currentOrderBy: this.orderBy,
|
||||||
currentOrderDesc: this.orderDesc,
|
currentOrderDesc: this.orderDesc,
|
||||||
|
currentSearch: this.search,
|
||||||
loadingDelayed: false,
|
loadingDelayed: false,
|
||||||
sortTriggered: false
|
reloadTriggered: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
visibilityChanged(isVisible, entry) {
|
visibilityChanged(isVisible, entry) {
|
||||||
if (isVisible) {
|
if (isVisible) {
|
||||||
// infinite scrolling
|
// infinite scrolling
|
||||||
this.sortTriggered = false;
|
this.reloadTriggered = false;
|
||||||
this.handler(this.currentOffset, this.limit, this.currentOrderBy, this.currentOrderDesc);
|
this.handler(this.currentOffset, this.limit, this.currentOrderBy, this.currentOrderDesc, this.currentSearch);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
pushRows() {
|
pushRows() {
|
||||||
@ -121,8 +128,12 @@ export default {
|
|||||||
this.currentOrderDesc = false;
|
this.currentOrderDesc = false;
|
||||||
}
|
}
|
||||||
this.currentOrderBy = e.orderBy;
|
this.currentOrderBy = e.orderBy;
|
||||||
console.log(e);
|
this.reloadTriggered = true;
|
||||||
this.sortTriggered = true;
|
this.clear();
|
||||||
|
},
|
||||||
|
searchChanged(e) {
|
||||||
|
this.currentSearch = e;
|
||||||
|
this.reloadTriggered = true;
|
||||||
this.clear();
|
this.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
more(offset, limit, orderBy, orderDesc) {
|
more(offset, limit, orderBy, orderDesc, search) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.$store.dispatch('apiRequest', {
|
this.$store.dispatch('apiRequest', {
|
||||||
endpoint: 'users',
|
endpoint: 'users',
|
||||||
@ -47,7 +47,8 @@ export default {
|
|||||||
start: offset,
|
start: offset,
|
||||||
length: limit,
|
length: limit,
|
||||||
orderBy,
|
orderBy,
|
||||||
orderDesc
|
orderDesc,
|
||||||
|
search
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(rows => {
|
.then(rows => {
|
||||||
|
Loading…
Reference in New Issue
Block a user