Add refresh functionality #79
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Good day,
This PR aims to add a way to recalculate values based on rows, without reloading the table.
Ex.: I have a receipts table and would like to have the total.
Using the ReceiptsDataProvider, I will pass the sum of my currently loaded rows as a calculated total to the context of my application. This works with the current implementation of the table. But if I do update a row, I am forced to reload the table to have access to the new information, lose the currently selected row, etc....
With this implementation, we separate the loading of the data from the calculated values and can recall it as many times as needed without reloading data and keeping the selected row selected.
A nice unintended effect is that we gain access to the list of RwSignal that can be shared out of the table, while keeping the data in sync. This is not yet tested on my part, as it was not the intended use case. If this creates more problem then it solve, a signal would suffice to the intended use case of refresh. Otherwise, it would allow for side forms directly affecting the table and vice-versa.
I did not spend days studying the library, so if anything seems out of place, or could be improved, I am all hears.