bootstrap table won't refresh if table is busy
See original GitHub issueIn the documentation it states that the table won’t call the provider if the table is manually put in the busy state but it looks like regardless of whether or not it is in the busy state or even if I manually set busy to false to refresh the provider I am unable to force a refresh of the table provider. I am on Windows 10 using Chrome/Firefox.
My use case is this, when the page loads I am fetching some of the options and default values for the user. The provider gets called before I can load these options and makes a request. The options load and I call table.refresh but it always fails as the table is in a busy state. I would like to be able to abandon the previous refresh and tried using a CancellationToken with axios but found that even though I could cancel the call it still didn’t have enough time to set the tables busy state to false. There needs to be a way to refresh the table and cancel/abort any previous request.
Currently I have had to fall back to a non-optimal pattern shown below.
triggerRefresh() {
var self = this;
if (self.$refs.listtable.busy) {
var handle = window.setInterval(function () {
if (!self.$refs.listtable.busy) {
window.clearInterval(handle);
self.$refs.listtable.refresh();
}
}, 30);
}
else {
self.$refs.listtable.refresh();
}
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (5 by maintainers)
Top GitHub Comments
@tmorehouse is there any way to cancel the previous provider function. If I call refresh 3 time in succession I wouldn’t expect it to wait for the results of the first call before triggering it a second time and so on. Granted some form of debounce would help but if the query is long running I want to abandon it and immediately start the 3rd.
Are you using the
.sync
modifier to update your copy of thebusy
prop?You could also have your provider function return an empty array
[]
initially and then after your options are set up, then have your provider to the actual fetch.