Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ea92ae7

Browse filesBrowse files
committed
feat: CDataTable - add filtered-items-change event
1 parent e3fcf96 commit ea92ae7
Copy full SHA for ea92ae7

File tree

Expand file treeCollapse file tree

1 file changed

+14
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+14
-4
lines changed

‎src/components/table/CDataTable.vue

Copy file name to clipboardExpand all lines: src/components/table/CDataTable.vue
+14-4Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,7 @@ export default {
297297
}
298298
},
299299
items (val, oldVal) {
300-
if (
301-
val && oldVal && val.length === oldVal.length &&
302-
JSON.stringify(val) === JSON.stringify(oldVal)
303-
) {
300+
if (val && oldVal && this.objectsAreIdentical(val, oldVal)) {
304301
return
305302
}
306303
this.passedItems = val || []
@@ -310,6 +307,15 @@ export default {
310307
handler (val) {
311308
this.$emit('pages-change', val)
312309
}
310+
},
311+
sortedItems: {
312+
immediate: true,
313+
handler (val, oldVal) {
314+
if (val && oldVal && this.objectsAreIdentical(val, oldVal)) {
315+
return
316+
}
317+
this.$emit('filtered-items-change', val)
318+
}
313319
}
314320
},
315321
computed: {
@@ -517,6 +523,10 @@ export default {
517523
paginationChange (e) {
518524
this.$emit('pagination-change', Number(e.target.value))
519525
this.perPageItems = Number(e.target.value)
526+
},
527+
objectsAreIdentical (obj1, obj2) {
528+
return obj1.length === obj2.length &&
529+
JSON.stringify(obj1) === JSON.stringify(obj2)
520530
}
521531
}
522532
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.