question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

b-table with spinner on filter

See original GitHub issue

I feel like I’m missing something really simple here, so I apologize initially for the question.

I’ve got a very large table which I’m rendering using a b-table. I’ve been reading through the various issues around table performance and I’ve implemented pagination and a primary-key etc… but now I’d like to have a simple spinner for the filtering event (which takes 1-2 seconds).

  methods: {
    setFilter() {
      this.loading = true
      console.log('this.loading = ', this.loading)
      this.filter = this.filterInput
    },
    clearFilter() {
      this.filter = ''
      this.filterInput = ''
    },
    onFiltered(filteredItems) {
      this.totalRows = filteredItems.length
      this.currentPage = 1
      this.loading = false
      console.log('this.loading = ', this.loading)
    },
  },

I’ve got a v-if’d div that handles the spinner based on this.loading it works just fine for the initial load and parse of the data. But for some reason it never fires here. When I click filter (or press enter on the input) setFilter is called, but I never see the spinner, and then eventually the results are filtered. I know this is not a bug with b-table, but I’m confused as to why I see the value of this.loading changed in the console but no evidence in the DOM rendering. I tried sprinkling this.$nextTick around but that didn’t seem to help.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Hiwscommented, Jun 24, 2020

Try using a double setTimeout. http://www.hesselinkwebdesign.nl/2019/nexttick-vs-settimeout-in-vue/ (You might find better explanations on the issue/difference between the two, but this was the first link on google)

setFilter() {
  this.loading = true;
  setTimeout(() => {
    setTimeout(() => {
      this.filter = this.filterInput;
    });
  });
}
0reactions
Hiwscommented, Jun 24, 2020

Sadly can’t give you an answer for that. Usually one is enough, as was your case. But I’ve found that sometimes two is required. It might have to do with the overlays innerworkings as, it might (not sure) use nextTick/setTimeout internally which could conflict with the flow.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular Material part 2: Material table - spinner, filter, sorting
Second video where i am showing basic usage of Angular Material library. We will add spinner and filter to our table.
Read more >
tabletop lazy susan turntable - Amazon.com
Filters. RESULTS. Price and other details may vary based on product size and color. 12 Inch Acacia Wood Lazy Susan Turntable for Table,...
Read more >
Table Lazy Susan Spinner | Bed Bath & Beyond
Searching for the ideal table lazy susan spinner? Shop online at Bed Bath & Beyond to find just the table lazy susan spinner...
Read more >
Show Loading pinner on Filter Table based on Radio selected ...
Problem is that in your example data is filtered almost immediately, so the spinner won't be visible. – Michał Tkaczyk. Oct 22, 2020...
Read more >
Scroll Through Report Filter Items - Excel Pivot Tables
... to select one or more items in a pivot table's Report Filter. ... There are instructions on that page for building your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found