F
F
fessss2021-07-28 14:13:47
Vue.js
fessss, 2021-07-28 14:13:47

Custom table component?

Made a wrapper for the vuetify v-data-table component

<v-data-table
        v-bind:value="value"
        v-on:input="$emit('input', $event)"
        disable-sort
        :item-key="itemKey"
        class="elevation-0"
        :items-per-page="state.take"
        :page="state.skip"
        :show-select="selectEnable"
        :headers="headers"
        :hide-default-footer="simple"
        :hide-default-header="simple"
        :server-items-length="serverTotal"
        :items="items"
        :calculate-widths="true"
        :footer-props="{
            'items-per-page-options': [10, 20, 50, -1]
          }"
        @update:items-per-page="$emit('itemsPerPageEvent', $event)"
        @update:page="$emit('setPage', $event)"
>
    <template v-slot:item="{ item }">
        <slot :row="item"></slot>
    </template>
</v-data-table>


<table-component
        v-model="selected"
        :headers="headers"
        :items="documentSessionItems"
        :state="state"
        :show-toolbar="showToolbar"
        :server-total="tableFilter.total"
        :filters="filters"
        item-key="id"
        select-enable
        @itemsPerPageEvent="setItemsPerPage($event)"
        @setPage="setPage($event)"
        @updateTableByFilters="updateTable($event)"
>
    <template slot-scope="{ row }">
        <tr>
            <td>
                <v-checkbox
                        v-model="selected" :value="row"/>
            </td>
            <td>{{ row.createdDate }}</td>
            <td>{{ row.name }}</td>
        </tr>
    </template>
</table-component>


The problem is that the checkbox that is added does not work. That is, when loading the table, for some reason it immediately stands as affixed and when you click on it, errors begin to pour in. There is an assumption that I am somehow not correctly forwarding the slots or doing something wrong with the checkboxes.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question