vue-table
vue-table copied to clipboard
Feature: Allow SelectedTo to contain full row value
It would be nice if the array of selected items could contain more than just the ID
@Jigsaw5279 That would be risky for memory management.
It is designed to help you keep track of the selected row(s) across the whole data set, so that you can decided to do whatever you want later (using those ids). So, it was a design choice for me to keep only the id that it would not cost too much in term of memory usage.
On one hand, if you are only interested in the selected row of the current page, the data should already be in the memory and you can access them via tableData
prop.
On the other hand, if the selected rows are across multiple pages and when you decided to do something with them, I think those ids should be sent to be processed on the server side.
Personally, I believe that the client side should only work with the presentation/interaction with end user. Any other business logic should be handled on the server side. :)
Yea, I kniw about the risks of memory leakage.. But I've made a component that'll display a dropdown of actions. And I wanted to make it aware of the data that is about to be transformed.
For example, I've got a table of aacounts, wich are either enabled or disabled. It makes no sense to activate the "Activate" option, if there are only active acccounts selected.
I did so using a callback that is passed the array of currently selected Items. But so far, the only thing I can do is see if the size is > 0
cause all it contains are IDs.
Maybe it would be nice to have an event that fires when the selection changes to give you all the items needed?
@Jigsaw5279 Hmm, I don't quite see the picture. But does this one helps?
I might get it to work that way, at least I hope so