Optionally prevent <b-table>'s "sort-changed" event from triggering provider function
See original GitHub issueLet me start out by saying a huge thank you for the efforts on this package. I am a few days in the weeds with this issue, so if there’s something simple I’m overlooking, I do apologize for the noise, and please feel free to point me in the correct direction.
Is your feature request related to a problem? Please describe…
In order to handle deeply nested links, I am triggering a $router.push()
when the sort direction is changed via a listener on @sort-changed
. Additionally, I am watching the $route
object on the parent component and refreshing the table when $route
changes.
I’d like some way to prevent the sorting-changed
event from triggering the provider method, because this leads to duplicate provider calls, once when the event triggers, and once when the route changes, calling the vm.watch()
method which refreshes the table.
Describe the solution you’d like
Some mechanism to determine what event triggered the provider call: perhaps either an event modifier (e.g. @sort-changed.prevent
) or an additional context prop or a parameter passed to the data provider function itself.
Describe alternatives you’ve considered
I’ve also considered syncing the sort props on the parent component and then checking in the callback function mapped to the @sort-changed
event to see if the values match the context
object, but it appears at first glance the synced props are already mutated by the time that event fires.
Additional context
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (7 by maintainers)
Top GitHub Comments
Right-o. Had hoped to avoid as much custom implementation as possible, as for 90% of my use case, things are covered.
Yeah if the sort params are initially set.
We’ll close this for now (but it can still have conversations). If you find/discover anything else let us know.