Skip to content

Improvement: Fire <b-table> filtered-event when filteredItems array gets modified #1989

@ddweber

Description

@ddweber

In the current state of the b-table component the filtered event only gets fired when the length of the filteredItems array changes.
But there may be use cases when the length of the array does not change, but the array items itself have changed/ have been modified.
In my particular case i am implementing a dynamic scrolling for the table where data is fetched/loaded blockwise and pushed in rather then spliced out the items array, so that the count does not change at all.

My suggestion: Would it be possible to change the watcher for the filteredItems array to watch for array mutation instead of array length? Or are there any side effect (performance issues) that i did not think of?

Original:

filteredItems (newVal, oldVal) {
      if (this.localFiltering && newVal.length !== oldVal.length) {
        // Emit a filtered notification event, as number of filtered items has changed
        this.$emit('filtered', newVal)
      }

Improved:

filteredItems (newVal) {
      if (this.localFiltering) {
        // Emit a filtered notification event, as filteredItems array has changed
        this.$emit('filtered', newVal)
      }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions