vue-table icon indicating copy to clipboard operation
vue-table copied to clipboard

How can i update vuetable with custom data ?

Open Nisthar opened this issue 8 years ago • 6 comments

I have an ajax function where i get custom data from the server. So i already have some data on the vuetable. I want to manually refresh the table and add the custom data.

Nisthar avatar Dec 03 '16 13:12 Nisthar

@Nisthar If I understand you correctly, you would like to have vuetable using the data you've already retrieved via existing ajax function, right? If so, you cannot, vuetable will automatically load the data from the server via api-url prop. If I misunderstand your point, please explain more.

ratiw avatar Dec 04 '16 06:12 ratiw

Yes, But in addition to the automatic ajax function of the vuetable, i want to manually do ajax and change the data of the vuetable.

Anyway, I accomplished this with another way. I changed the apiUrl prop of the vuetable and set it to new url which returns the custom data that i want (not the original data) and refreshed the table. So the table got populated with the custom data.

BTW is there any other way like manually setting the "tableData" with custom data and refreshing the table?

On Sun, Dec 4, 2016 at 11:56 AM, Rati Wannapanop [email protected] wrote:

@Nisthar https://github.com/Nisthar If I understand you correctly, you would like to have vuetable using the data you've already retrieved via existing ajax function, right? If so, you cannot, vuetable will automatically load the data from the server via api-url prop. If I misunderstand your point, please explain more.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ratiw/vue-table/issues/132#issuecomment-264687165, or mute the thread https://github.com/notifications/unsubscribe-auth/ALcELXTzpGvaD4lSWc5xTtBwzJYUOXOwks5rEl0xgaJpZM4LDS_B .

Nisthar avatar Dec 04 '16 10:12 Nisthar

@Nisthar There is actually another component called vueitems, but it serves different purpose than vuetable.

With vueitems you have to manually retrieve the data yourself and give it to vueitems to display. It is aimed to be part of a form input (think of invoice items), so many functionalities related to pagination, sorting are removed. However, I haven't put any documentation on the project, but most of the props and events are the same as vuetable. You just need to go through source code to learn about it.

ratiw avatar Dec 04 '16 13:12 ratiw

I also think there should be a way to set any data to the table. May be a callback function or event. There are many cases where you dont need to make an api call to display a table with some info.

nkostadinov avatar Feb 11 '17 19:02 nkostadinov

Yes, absolutely. What about a prop to provide data to the table, and if it's not used, then use the API call (or vice versa - doesn't really matter)? I really want to use vue-table but this is a requirement for my needs.

zxc23 avatar Aug 04 '17 13:08 zxc23

I managed to reload vuetable for non-api table when data is changed in the background with this.$refs.vuetable.setData(this.data).

maleta avatar Mar 15 '18 22:03 maleta