bug fix in 'isLoading' spinner in 'remote' mode #474
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.
I have a situation where I make ajax call and it fails in the 'remote' mode and the 'loading' bar still appears in the table. Lets consider the scenario, i make a ajax request as follows,
possibility 1 : changing the isLoading status to false which is potentially not working
Reason :
Table.vue L472
Let say i sorted a column and it sets 'this.tableLoading' to true and I make a ajax call to get a new set of data, but unfortunately it fails and i manually change 'this.isLoading' to 'false' from parent component. Now, in 'VueGoodTable' component, this.isLoading is false and this.tableLoading is still true, so the computed value of 'isTableLoading' is still be true, which means it wont hide the loading indicator.
possibility 2 : Making a deep copy of my old data and setting it to this.row which triggers the 'row' watcher in VueGoodTable component potentially hiding the indicator. But this is not the right way to control loading indicator IMHO.
My solution:
In the parent component make a 'isLoading' prop with '.sync' modifier which listens for events from vue table to change the state of loading indicator.
In the VueGoodTable component, just emit the event 'update:isLoading' with true or false to show or hide the loading indicator, which I modified already in the current source code. Please have a look at the changes and accept this pull request.