You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
renderAhead: 2, // Buffer, +2 at top / bottom in queue
103
132
estimatedHeight: 20, // We need to assume that there is some default height for each row which will be recalculated later
104
133
};
@@ -109,7 +138,7 @@ export default {
109
138
110
139
## ExpandingList
111
140
112
-
Wrapper for VirtualScroll. It adds simple functionality of flattening passed items and toggling visibility of groups.
141
+
Wrapper for VirtualScroll. It adds simple functionality of flattening passed items and toggling visibility of groups. Allowing to render tree data structures.
113
142
114
143
Example:
115
144
@@ -120,13 +149,18 @@ Example:
120
149
:items="items"
121
150
:render-ahead="renderAhead"
122
151
:estimated-height="estimatedHeight"
123
-
:expanded-group="expandedGroup"
124
152
@expand="onExpandGroup">
125
-
<template #group="{ item, index }">
126
-
<div v-text="item" />
153
+
<template #header>
154
+
<!-- Might be added sticky / floating header -->
127
155
</template>
128
-
<template #item="{ item, index }">
129
-
<div v-text="item" />
156
+
<template #body>
157
+
<!-- Might be added custom body which will overwrite DOM virtualization - useful for presenting placeholders in case that there is no data -->
renderAhead: 2, // Buffer, +2 at top / bottom in queue
143
191
estimatedHeight: 20, // We need to assume that there is some default height for each row which will be recalculated later
144
-
expandedGroup: '',
145
192
};
146
193
},
147
194
methods: {
148
-
onExpandGroup(group) {
149
-
// You may fetch data here and mutate items object
150
-
// this.items[group] = ['a', 'b', 'c', 'd'];
151
-
152
-
this.expandedGroup = group;
195
+
onExpandGroup(item) {
196
+
// We might want to asynchronously prefetch data for expanded group
153
197
}
154
-
}
198
+
}
155
199
}
156
200
</script>
157
201
```
@@ -163,34 +207,18 @@ Props:
163
207
| items | list of items |[] or {} for Nested/Expanding List |
164
208
| renderAhead | number of buffered items at the top/bottom | 2 |
165
209
| estimatedHeight | approximated value of each row height | 30 |
166
-
|expandedGroup|key of expanded group - only for ExpandingList | '' |
210
+
|expanded|the flag which toggles between state of all items - only for ExpandingList | '' |
167
211
168
212
Events:
169
213
170
214
- expand: click event for group element which toggles between visible state of group items - only for ExpandingList
171
215
172
216
### Tips
173
217
174
-
Do not use margin directly for styling node items! Height won't be measured well.
175
-
{: .alert .alert-danger}
218
+
> :error: Do not use margin directly for styling node items! Height won't be measured well.
176
219
177
-
Each virtualized component by default will expand height by 100%, to override it and make things happening you either have to set height / max-height of component or by implementing dynamic height content with flexbox / grid.
178
-
{: .alert .alert-info}
220
+
> :information_source: Each virtualized component by default will fully expand, to make things happening you either have to set height / max-height of component or by implementing dynamic height content with flexbox / grid.
0 commit comments