mercredi 16 février 2022

Vuetify checkbox unchecked when changing pagination

i have datatable that contain checkbox in actions column

my datatable on template

<v-data-table
                    :headers="head"
                    :items="items"
                    :items-per-page="10"
                    class="elevation-1"
                    :loading="loading"
                >   
                    <template v-slot:item.filename={item}>
                        
                    </template>

                    <template v-slot:item.circuit={item}>
                        <v-chip :color="getStatus(item.circuit)" dark>
                            
                        </v-chip>
                    </template>

                    <template v-slot:item.actions="{ item, index }">
                        <div class="d-flex">
                            <v-icon
                                small
                                @click="deleteItem(item)"
                            >
                                mdi-delete
                            </v-icon>

                            <v-checkbox
                                multiple
                                class="ml-4"
                                :value="item"
                                :true-value="item"
                                v-model="fileselected"
                                v-if="isInused(item)"
                            >
                            </v-checkbox>
                        </div>
                    </template>
                </v-data-table>

my headers options on data

head: [
    { text: 'Fichier', align: 'start', value: 'filename' },
    { text: 'Circuit', align: 'start', value: 'circuit' },
    { text: 'Action', align: 'start', value: 'actions' }
],

so when i check some in the first page, it added to my model, i swtich to another page to check some other, and when i return to the previous page, all checkbox checked recentely are unchecked but my model value is inchanged; and i return to the other page, all checked checkbox are unchecked too. If i recheck the recently checked one, my model value still inchanged and if i uncheck it, the item is removed from my model. as if my checkbox not understand that he is checked and in the model when i change page;

Edit I have another checkbox that make all items checked, so all of it are in model, but when i change page, the sae behavior is occured, but if i used the option to show all row, all the unchecked in the page still unchecked, but the rest of the list are all checked

Other Edit I noticed that if i check some on one page, i switch page, and check other some in this page, all recently checked from the first page all removed from the model




Aucun commentaire:

Enregistrer un commentaire