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> filtering occurs when row details get toggled -> performance loss, working with 16k rows

See original GitHub issue

Is it a feature or a bug, that the filter-function gets called again for all items when the row details of one row gets toggled? I´m working with a fairly big amount of items (~16k rows) and this behavour slows down the user experience a lot.

I tested the behaviour in the playground area with the following code:

<div id='app'>
  <b-table :items="items" :fields="fields" :filter="filterfct">
    <template slot="show_details" slot-scope="row">
      <!-- we use @click.stop here to prevent emitting of a 'row-clicked' event  -->
      <b-button size="sm" @click.stop="row.toggleDetails" class="mr-2">
       {{ row.detailsShowing ? 'Hide' : 'Show'}} Details
      </b-button>
      <!-- In some circumstances you may need to use @click.native.stop instead -->
      <!-- As `row.showDetails` is one-way, we call the toggleDetails function on @change -->
      <b-form-checkbox @click.native.stop @change="row.toggleDetails" v-model="row.detailsShowing">
        Details via check
      </b-form-checkbox>
    </template>
    <template slot="row-details" slot-scope="row">
      <b-card>
        <b-row class="mb-2">
          <b-col sm="3" class="text-sm-right"><b>Age:</b></b-col>
          <b-col>{{ row.item.age }}</b-col>
        </b-row>
        <b-row class="mb-2">
          <b-col sm="3" class="text-sm-right"><b>Is Active:</b></b-col>
          <b-col>{{ row.item.isActive }}</b-col>
        </b-row>
        <b-button size="sm" @click="row.toggleDetails">Hide Details</b-button>
      </b-card>
    </template>
  </b-table>
</div>
  data () {
    return {
      fields: [ 'first_name', 'last_name', 'show_details' ],
      items: [
        { isActive: true, age: 40, first_name: 'Dickerson', last_name: 'Macdonald' },
        { isActive: false, age: 21, first_name: 'Larsen', last_name: 'Shaw' },
        { isActive: false, age: 89, first_name: 'Geneva', last_name: 'Wilson', _showDetails: true },
        { isActive: true, age: 38, first_name: 'Jami', last_name: 'Carney' }
      ]
    }
  },
    methods: {
      filterfct: function(row){
        console.log('filterfct');
        return true;
      }
    }

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
emanuelmutschlechnercommented, Apr 26, 2018

My guess is, that <b-table> uses a computed property for items. So when _showDetails in items changes from true to false or vice versa, the computed property updates due to the change of the items array.

I don’t have a general solution to this problem. Feel free to drop your ideas here

1reaction
emanuelmutschlechnercommented, Apr 26, 2018

@ddweber I can confirm this issue.

@Diaskhan See my example below https://codesandbox.io/s/q3onr4p749

Read more comments on GitHub >

github_iconTop Results From Across the Web

Filter data in a range or table - Microsoft Support
Select any cell within the range. Select Data > Filter. Filter button. Select the column header arrow Filter arrow . Select Text Filters...
Read more >
The Ultimate Guide to Excel Filters with VBA Macros
This is an extensive guide on the AutoFilter method in VBA. ... Filters work the same on both regular ranges and Excel Tables....
Read more >
Notes and restrictions for row-Level and cell-level filtering
To apply a data filter with a row filter expression, you must have SELECT with the grant option on all table columns.
Read more >
power bi make multi row card horizontal - Retro Remix Advance
Refer – Multi row card visual Using this feature you can now select rows in your ... downloadFile(format, options) Exports table data as...
Read more >
Excel filter not working after a certain row - AuditExcel
You can see it finds two, but note that below it there is other data and other 31 Aug's. The clue of the...
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