bhaveshpatel200 / vue3-datatable-document

vue3-datatable-document.vercel.app
MIT License
22 stars 10 forks source link

Refresh table UI after updating table data (array) #5

Open AhmedAdelAlemam opened 1 year ago

AhmedAdelAlemam commented 1 year ago

I have a suggestion to add a refresh (method/function) to refresh the table UI after modifying the data array (push/pop)

like this scenario

` //initialize with empty array. let rows = ref<Array>([]); onMounted(() => { //add data to the rows array after mounting. rows = ref<Array>(rowsData.data); });

// function to add new items to the table binding it to an input file field const addFile = (items: any) => { for (let item of items) { rows.value.push({ size: ${iterm.size}kb, name: item.name, type: item.type, updated: item.lastModifiedDate, created: "", id: rows.value.length, }); } }; `

The expected result is updating the table UI after pushing a new element to the array. The result is that the table UI is not updated and the data is same as rendered after mounting.

bhaveshpatel200 commented 1 year ago

Hi,

This package already watching data rows changes and refresh automatically, so not need to refresh method or functions for it. may be you did not implement properly.

We have already used in our project and it's working fine.

I will check your scenarios and will add new demos with crud operation(add/update/delete)e, so user can get code easily.

Can you please let me know are you using server side rendering or client side rendering datatable ?

AhmedAdelAlemam commented 1 year ago

I'm using client-side

sahilbhardwaj1 commented 1 month ago

@bhaveshpatel200 i am facing same issue, i delete the data from table but the date does not update in table.