File tree 1 file changed +13
-9
lines changed 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change 124
124
return {
125
125
localSortBy: this .sortBy || ' ' ,
126
126
localSortDesc: this .sortDesc || false ,
127
- localItems: []
127
+ localItems: [],
128
+ // Note: filteredItems only used to determine if # of items changed
129
+ filteredItems: []
128
130
};
129
131
},
130
132
props: {
263
265
this ._providerUpdate ();
264
266
}
265
267
},
268
+ filteredItems (newVal , oldVal ) {
269
+ if (! this .providerFiltering && newVal .length !== oldVal .length ) {
270
+ // Emit a filtered notification event, as number of filtered items has changed
271
+ this .$emit (' filtered' , newVal);
272
+ }
273
+ },
266
274
sortDesc (newVal , oldVal ) {
267
275
if (newVal === this .localSortDesc ) {
268
276
return ;
383
391
384
392
// Apply local filter
385
393
if (filter && ! this .providerFiltering ) {
386
- // Number of items before filtering
387
- const numOriginalItems = items .length ;
388
-
389
394
if (filter instanceof Function ) {
390
395
items = items .filter (filter);
391
396
} else {
401
406
return test;
402
407
});
403
408
}
404
-
405
- if (numOriginalItems !== items .length ) {
406
- // Emit a filtered notification event, as number of items has changed
407
- this .$emit (' filtered' , items);
408
- }
409
+ }
410
+ if (! this .providerFiltering ) {
411
+ // Make a local copy of filtered items to trigger filtered event
412
+ this .filteredItems = items .slice ();
409
413
}
410
414
411
415
// Apply local Sort
You can’t perform that action at this time.
0 commit comments