design-system-react icon indicating copy to clipboard operation
design-system-react copied to clipboard

Fixed Columns Headings + Infinite Scroll/Lazy Load on Data-Tables

Open TheJaredWilcurt opened this issue 10 years ago • 15 comments

My team is in the planning stages for creating a new All Audiences/Audience Lists page using SLDS for React (Boiler Plate).

Here's a screenshot from the (not yet finished) designs:

Audience Lists

I was told by Vineeth Nair, who is working on these designs, that pagination is meant to be controlled via infinite scroll. He said that it is meant to extend the height of the page and not be contained in a scrollable div (with overflow).

When we start in on coding this project, we'd like to avoid creating the infinite scrolling custom for our app as it seems like a feature that other teams will need in the component as well.

Can we get something like the following as options in data-tables:

NAME TYPE REQUIRED DEFAULT DESCRIPTION
infiniteScroll bool false false Enables lazy loading of content when the last row is visible
height number string false 'auto'
pageSize number false 25 If infinite scroll is on this will be the limit on amount of rows to add at a time
pageOffset number false

TheJaredWilcurt avatar Apr 22 '16 20:04 TheJaredWilcurt

@TheJaredWilcurt Thank you for the request: we are planning to start working on advanced data grid component soon. @bado22 let me know if this feature request is close to your requirements

ivanbogdanov avatar Apr 23 '16 00:04 ivanbogdanov

@madpotato @TheJaredWilcurt The idea of infinite scroll rather than pagination is close to my requirements.

I am currently using the FlexTable component from react-virtualized which isn't exactly doing an infiniteScroll. They call it a VirtualScroll, but essentially it is adding & removing rows from the DOM based on offset. So whereas an infiniteScroll might append DOM elements as you scroll down the page, react-virtualized will ALSO remove the elements that are out of view. This is obviously more tricky to get right, but could result in much different performance characteristics. No matter how far you scroll down the page of a 1,000,000 item list, there are still only 10 rows in the DOM (for example). My understanding is that to do this, you need to know the height of all the rows, how many rows are in the table (so you can calculate TOTAL height of ALL rows). You also need to know the height of the table (which is REQUIRED). Based on the height constraint for the table & the offset, you can calculate which rows to render.

Does that make sense? I think standard infiniteScroll makes sense when dealing with a few hundred rows, but once you have a really large table, performance would suffer.

bado22 avatar Apr 25 '16 13:04 bado22

@tweettypography How does this relate to what we're trying to do in #246 ?

arunjeetsingh avatar Apr 25 '16 17:04 arunjeetsingh

@arunjeetsingh @TheJaredWilcurt We're adding a basic DataTable in #246, but it won't have infinite scroll right out of the box. An advanced grid, possibly based on react-virtualized, could be used to support this use-case, or infinite scrolling could be added into the basic DataTable. As @bado22 points out, naïve infinite scrolling appropriate for many use-cases could be implemented into a component without sacrificing much, or a component might trade simplicity and flexibility to enable something like the virtualized scrolling for really large tables that need the performance improvement.

tweettypography avatar Apr 25 '16 17:04 tweettypography

@bado22 @TheJaredWilcurt Are you interested into contributing to Advanced Data Grid component? I am talking to system team (css / html component designers) to create alternative div-based markup for data grids.

ivanbogdanov avatar Apr 25 '16 18:04 ivanbogdanov

@madpotato yes, definitely interested.

bado22 avatar Apr 25 '16 20:04 bado22

When we were discussing infinite scroll, we did come to the conclusion that being able to prepend rows was just as important as being able to append them. So the virtual scroll may work for that, but I think I need a better explanation of how the virtual scroll works. It sounds to me like it would be hammering the server a lot more.

As far as contributing to this, I'll need to check with our product owner on if he wants to dedicate time for the UI engineers on our project to work on this or not. From my understanding, we are trying to build as few custom components as possible, and to instead either rely on what exist in SLDS and SLDS for React, or to request things be added to those libraries if they are in the designs but don't already exist.

TheJaredWilcurt avatar Apr 28 '16 19:04 TheJaredWilcurt

@mbeard

jwilcurt-salesforce-com avatar Jul 20 '16 20:07 jwilcurt-salesforce-com

@tweettypography this recently surfaced again as a need and dependency for one of the teams. Can we reprioritize.

mbeard avatar Jul 21 '16 14:07 mbeard

@ivanbogdanov I remember the conversations on a div-based table stalled for accessibility reasons. I'm going to look into a solution for this, do you have any update on where you left it?

cc: @mbeard

tweettypography avatar Jul 21 '16 20:07 tweettypography

@jamin-hall

kwilloughby avatar Aug 03 '16 17:08 kwilloughby

Proposed tree has a style attribute that can be set to overflow:hidden and onScroll callback that returns the target and the percentage. We will probably want to follow that pattern and then consuming developers can add to the data.

What is the SLDS pattern for infinite scroll?

interactivellama avatar Aug 23 '16 16:08 interactivellama

@mbeard Has there been any progress on implementing a solution for this issue?

cc: @interactivellama

mattwells424 avatar Oct 13 '16 14:10 mattwells424

@donnieberg Here is the Fuel UX code we used for infinite scroll in it's DataTable.

http://fuelux-edge.herokuapp.com/#infinitescroll https://github.com/ExactTarget/fuelux/blob/master/js/infinite-scroll.js#L82

interactivellama avatar Feb 28 '17 22:02 interactivellama

Closing and combining with #676

interactivellama avatar Aug 03 '18 21:08 interactivellama