Closed BossHogg97 closed 1 year ago
Hey @BossHogg97 , is there any way you can reproduce the issue with a Stackblitz or a Codesandbox?
There's a Stackblitz here that you can use as a reference: https://stackblitz.com/edit/vue-w4juwm?file=src/App.vue and an example in the playground that covers setting the data using the composition API. You can check it here: https://github.com/kouts/vue-dataset/blob/next/playground/views/Example2.vue
HI! Yesterday I found a solution for my problem. I did a "push" on adding an element when I had to reassign the new array to the dataset. I didn't understand why in the development environment everything worked fine and in production it didn't but ok :)
I show the code if someone need it:
dsAdd(dsRollType: any, row: rsRollType) {
const newElementBase = this.createCardObject(row)
dsRollType.value = [...dsRollType.value, newElementBase]
}
dsUpdate(dsRollType: any, row: rsRollType) {
const updatedElement = this.createCardObject(row)
const index = dsRollType.value.findIndex((object) => {
return object.id === row.id
})
const tempDataset = dsRollType.value
tempDataset.splice(index, 1, updatedElement)
dsRollType.value = [...tempDataset]
}
dsDelete(dsRollType: any, id: string) {
const index = dsRollType.value.findIndex((object) => {
return object.id === id
})
const tempDataset = dsRollType.value
tempDataset.splice(index, 1)
dsRollType.value = [...tempDataset]
}
Thanks ;)
Hi, i'm workin on Vue 3.2 + naiveUI. The dataset is working fine in dev environment but when i build the web app (production env) the dataset doesn't update reactive but i have to reload the page when i add a new item to array of object.
Main .vue component instructions:
Dataset component definition on template
The following function is from external class:
Is there also a way to delete an item from dataset without reload the page?
Thanks