0
0
Fork 0

add table rows selection

This commit is contained in:
William Buezas 2024-01-31 21:22:32 -03:00
parent 7d9b34d4c5
commit bb1ddf5900
1 changed files with 14 additions and 0 deletions

View File

@ -20,6 +20,7 @@ const { t } = useI18n();
const visibleColumns = ref([]); const visibleColumns = ref([]);
const allColumnNames = ref([]); const allColumnNames = ref([]);
const rows = ref([]); const rows = ref([]);
const rowsSelected = ref([]);
const columns = computed(() => [ const columns = computed(() => [
{ {
label: t('entry.latestBuys.picture'), label: t('entry.latestBuys.picture'),
@ -203,6 +204,10 @@ const columns = computed(() => [
}, },
]); ]);
const openEditRowField = () => {
console.log('open edit row form: ', rowsSelected.value);
};
onMounted(async () => { onMounted(async () => {
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
const filteredColumns = columns.value.filter((col) => col.name !== 'picture'); const filteredColumns = columns.value.filter((col) => col.name !== 'picture');
@ -239,10 +244,12 @@ onMounted(async () => {
:rows="rows" :rows="rows"
:columns="columns" :columns="columns"
hide-bottom hide-bottom
selection="multiple"
row-key="id" row-key="id"
:pagination="{ rowsPerPage: 0 }" :pagination="{ rowsPerPage: 0 }"
class="full-width q-mt-md" class="full-width q-mt-md"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
v-model:selected="rowsSelected"
> >
<template #body-cell-picture="{ row }"> <template #body-cell-picture="{ row }">
<QTd> <QTd>
@ -295,9 +302,16 @@ onMounted(async () => {
</QTd> </QTd>
</template> </template>
</QTable> </QTable>
<QPageSticky :offset="[20, 20]">
<QBtn @click="openEditRowField()" color="primary" fab icon="edit" />
<QTooltip>
{{ t('Edit buy(s)') }}
</QTooltip>
</QPageSticky>
</QPage> </QPage>
</template> </template>
<i18n> <i18n>
es: es:
Edit buy(s): Editar compra(s)
</i18n> </i18n>