vue-ads-table-tree
vue-ads-table-tree copied to clipboard
Collapsing/expanding grouped rows got broken in 2.4.2
Unfortunately commit 98e6ff22495a8b5ad8d468fa79025c49f45c592d broke collapsing/expanding the groups. To be precise I'm talking about group rows, not parent-child relationships.
Hi, @arnedesmedt . Sorry to remind. Is there a chance you'll fix this before Christmas break (it starts Dec 25 for you I assume)? If not any time soon, please let me know - I'll try to find a fix (need this early January).
Hi, I can't fix this before the first january. I'm moving to another house. But maybe you can try it yourself?
I'll try to find time for that. Thanks for keeping me informed. Merry upcoming Christmas! :-)
There is some Vue reactive magic going on. groupBy.js
used to contain groupRows
data field, which was never read, only assigned in 2 places: groupedRows()
and createGroupRow()
. Restoring this data field and the latter modification in createGroupRow()
makes things work again. What is most surprising is that groupRows()
isn't triggered! I would understand if it was, which would trigger flattenedRows()
and so on, but that's not the case.
Hi, @arnedesmedt . I hope you had good holidays :) Is it possible to release a new build with the above workaround (at least as a first step to solving this issue)? Collapse/expand functionality is important for a tree-like component.
Attaching a diff, so it is clear what I'm talking about in this comment.
diff --git a/src/mixins/groupBy.js b/src/mixins/groupBy.js
index 75acb4e..b6141d6 100644
--- a/src/mixins/groupBy.js
+++ b/src/mixins/groupBy.js
@@ -1,12 +1,19 @@
// TODO how to handle grouped data for async data
export default {
+ data () {
+ return {
+ groupRows: [],
+ };
+ },
+
computed: {
groupedRows () {
if (this.paginatedRows.length === 0) {
return this.paginatedRows;
}
+ // this.groupRows = [];
return this.groupingRows(this.paginatedRows, 0);
},
},
@@ -72,6 +79,7 @@ export default {
};
this.initRow(groupRow, 0, groupLength, column);
+ this.groupRows.push(groupRow);
return groupRow;
},