Skip to content

Commit

Permalink
Исправлено название столбца (isActive -> inArchive). Добавлена вьюха …
Browse files Browse the repository at this point in the history
…(компонент-представление) GridComponentView.vue для демонстрации возможностей грид компонента (включение/отключение фильтрации, многострочного выделения и т.д.) и необходимые мутации во Vuex модуль
  • Loading branch information
greenDev7 committed Jul 5, 2022
1 parent 48d4f03 commit 38d6148
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 7 deletions.
16 changes: 15 additions & 1 deletion src/store/modules/gridOptions.js
Expand Up @@ -105,7 +105,7 @@ export default {
},
{
type: "checkbox",
name: "isActive",
name: "inArchive",
caption: "В архиве",
width: "180px",
padding: "0px",
Expand All @@ -127,6 +127,20 @@ export default {
allowFiltering: true,
},
},
mutations: {
enableFiltering(state, allowFiltering) {
state.behaviorOptions.allowFiltering = allowFiltering;
},
enableMultipleSelection(state, allowMultipleSelection) {
state.behaviorOptions.allowMultipleSelection = allowMultipleSelection;
},
enableSelectAll(state, allowSelectAll) {
state.behaviorOptions.allowSelectAll = allowSelectAll;
},
enablePaging(state, allowPaging) {
state.behaviorOptions.allowPaging = allowPaging;
}
},
getters: {
getCommonTableOptions(state) {
let commonTableOptions = [];
Expand Down
114 changes: 108 additions & 6 deletions src/views/GridComponentView.vue
@@ -1,14 +1,116 @@
<template>
<GridComponent/>
<div id="container">
<div class="grid-settings">
<input
type="checkbox"
id="allowFilter"
name="filtering"
v-model="filterVisibleProperty"
/>
<label for="allowFilter">Фильтрация</label>
</div>
<div class="grid-settings">
<input
type="checkbox"
id="allowSelection"
name="selection"
v-model="selectionVisibleProperty"
/>
<label for="allowSelection">Мультистрочное выделение</label>
</div>
<div class="grid-settings">
<input
type="checkbox"
id="allowSelectAll"
name="selectAll"
v-model="selectAllVisibleProperty"
/>
<label for="allowSelectAll">Выделить все</label>
</div>
<div class="grid-settings">
<input
type="checkbox"
id="allowPaging"
name="paging"
v-model="pagingVisibleProperty"
/>
<label for="allowPaging">Пагинация</label>
</div>
<GridComponent @selectionChanged="showSelectedRowIds" />
<div id="selected-ids">Id выделенных строк: {{ selectedIds }}</div>
</div>
</template>

<script>
import GridComponent from '@/components/GridComponent.vue'
import GridComponent from "@/components/GridComponent.vue";
export default {
name: 'GridComponentView',
name: "GridView",
data() {
let selectedIds = "";
return { selectedIds };
},
components: {
GridComponent
}
}
GridComponent,
},
computed: {
filterVisibleProperty: {
get() {
return this.$store.getters.getBehaviorOptions.allowFiltering;
},
set(value) {
this.$store.commit("enableFiltering", value);
},
},
selectionVisibleProperty: {
get() {
return this.$store.getters.getBehaviorOptions.allowMultipleSelection;
},
set(value) {
this.$store.commit("enableMultipleSelection", value);
},
},
selectAllVisibleProperty: {
get() {
return this.$store.getters.getBehaviorOptions.allowSelectAll;
},
set(value) {
this.$store.commit("enableSelectAll", value);
},
},
pagingVisibleProperty: {
get() {
return this.$store.getters.getBehaviorOptions.allowPaging;
},
set(value) {
this.$store.commit("enablePaging", value);
},
},
},
methods: {
showSelectedRowIds(selectedRows) {
this.selectedIds = selectedRows.join(", ");
},
},
};
</script>

<style scoped>
#container {
width: 1200px;
margin-left: auto;
margin-right: auto;
}
.grid-settings {
margin-bottom: 10px;
}
#selected-ids {
margin-top: 50px;
}
</style>

0 comments on commit 38d6148

Please sign in to comment.