How to get the current visible group in a GroupedVirtuoso?
See original GitHub issueHey there, is there a way to efficiently get the current group in a GroupedVirtuoso? I currently do not see any Subscription for that.
I’ve tried to use rangeChanged but it seems it will misscount near the end of a list.
See this example that is using the GroupedVirtuoso example in combination with rangeChanged.
Do I really have to add some kind of counting logic myself or did I miss something?
rangeChanged={({startIndex}) => {
let countLeft = startIndex;
let group: string | undefined;
for (let i = 0; i < groupSizes.length; i++){
const groupSize = groupSizes[i] + 1/*groupHeader*/;
if (countLeft - groupSize <= 0) {
group = groups[i];
break;
}
countLeft -= groupSize;
}
if (group) {
console.log(group);
}
}}
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Getting Started with React Virtuoso | React Virtuoso
To start, install react-virtuoso in your React project. The package exports the Virtuoso , TableVirtuoso , GroupedVirtuoso , and VirtuosoGrid components.
Read more >react-virtuoso - Bountysource
How to get the current visible group in a GroupedVirtuoso? $ 0 ... I'm currently using the VirtuosoGrid component to render a long...
Read more >Virtuoso Visualization and Analysis XL User Guide
not make, and expressly disclaims, any representations or warranties as to ... Visible. Shows or hides the active graph. Split Current Strip.
Read more >16.3.3.Business Intelligence Extensions for SPARQL
Virtuoso extends SPARQL with SQL like aggregate and "group by" ... Example for get counts and total prices of ordered items, grouped by...
Read more >Issues · petyosi/react-virtuoso · GitHub
How to get the current visible group in a GroupedVirtuoso? #192 opened on Nov 9, 2020 by carstenpatzke.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

It is literally like the the example that I’ve linked. But instead of
Current visible range:I would like to see the current group. https://stackblitz.com/edit/react-xfltju?file=example.jsTechnically there should be a list of all groups and I want to highlight the current group: https://virtuoso.dev/scroll-to-group/
So I finally got around thinking about this again and thanks to @carstenpatzke to providing the solution for me to work on.