ratiw / vuetable-2

data table simplify! -- datatable component for Vue 2.x. See documentation at
https://vuetable.com
MIT License
2.16k stars 400 forks source link

Suggestion: allow preloaded data instead ajax through api-url #77

Open tsalufe opened 7 years ago

tsalufe commented 7 years ago

I think this is more general use to generate a table from preloaded array of table rows. Reasons are, some developer want to use one library to generate table even though vue-table-2 may be overkill so they can maintain only one set of design/styles. Also, sometimes, they want to toggle the data sources (not dynamically) based on performances without changing too much code.

ratiw commented 7 years ago

@tsalufe That is coming up as soon as I can find time to work on it. But please be aware, using preloaded data will also making other functionalities related to the server (like sorting) un-operational.

tsalufe commented 7 years ago

@ratiw I am looking forward to using it. I was thinking something like jquery DataTables, where sorting can be achieved by number value, or by string as default or using call back on the browser when using preloaded data.

ratiw commented 7 years ago

@tsalufe That will work so long as you do not have large data set.

Vuetable was designed to work with the server via AJAX from the beginning because when the data set becomes quite large, it is not feasible to process it on the client side.

I decided to add this as it has its own use. In my case, I'm using it to display order items inside my order form, so it doesn't need those server related functionalities.

kweku360 commented 7 years ago

Hi just to add my input. I think you should take into account state management libraries like redux or vuex when developing such a feature so that the tables can react to a provided state. Currently i am using Veux with vuetable-2 and i have noway of my tables reacting to state changes.

If currently there is a way you can please show me the way. thanx

ratiw commented 7 years ago

Sorry, @kweku360. As I don't use redux or vuex myself, I can't really help you with that.

But I think you should still be able to make vuetable-2 reacting to state changes manually by calling appropriate methods exposed by vuetable-2 when you've detected the change coming from vuex.

jan144 commented 7 years ago

This would be very useful if one would want to make API requests in Vuex, store the results in the Vuex state and get the data from there. That would, in some cases, seem like good practice instead of directly communicating with the API through the Vuetable.

ratiw commented 7 years ago

@jan144 It would be better that you open a new issue on that as this issue is not specifically about vuex. I can then tag it for help in case someone has already done that and would like to make a PR.