I need to create an Infinite scroll bar like virtual scrolling we already have in data grid 2. But the thing is virtual scrolling doesn't load the total number of data available or count the existing data out of total data or attributes available in the data grid 2. so I need to create infinite scroll bar more like virtual scroll which also provides the count of data present in data grid 2.
Maybe you can create a dataview around your grid with a microflow datasource and a non-persistent (NPE) helper entity (NPE) as return parameter. In your microflow do a retrieve on the entity used for your grid (make sure to match any xpath constraints) directly followed by a aggregate list action with a count. Create the NPE and set an attribute with the count.
Now you can use this attribute above your grid to display the total count of objects in your database.