InfiniteScrolling in 1.0
Hello Griddle Team! Congrats on releasing 1.0. Looking forward to using it.
Trying to migrate from 0.7.1 to 1.0 due to not being able to toggle column visibility out of the box and decided to just take the dive into 1.0.
Does Griddle still support Infinite Scrolling by setting a prop on the Griddle component, or is it possible now to integrate in a library like react-virtualized to handle rendering the RowDefinition components needed for Griddle?
Thanks!
Thanks so much -- we're excited to have it released. If you're successfully using 0.7.1 I would wait a bit until we have the official upgrade guide complete. @joellanciaux is kind of taking point on that one but it likely won't be too far off. That said, with the architecture changes, some of the plugins are not baked in to core Griddle and will be coming shortly there-after as plugins (namely subgrid and selection).
I would imagine someone could write a plugin for react-virtualized (and that would be really really cool to see), although the ability to have a pipeline of plugins may be lost depending on how the other plugins interact with the view components (it may not too -- I'd have to look more into how that could work).
Additionally, we have a plugin that does virtual scrolling that will be receiving some updates and performance fixes in the weeks to come that can be used as follows:
import Griddle, { plugins } from 'griddle-react'
...
<Griddle data={someData} plugins={[..., plugins.PositionPlugin({tableHeight: 600 }) />
https://github.com/GriddleGriddle/Griddle/blob/2988f42dd4b3db027587694028783f6507e7848d/stories/index.js#L258-L267 for more info on this. Please let us know if this helps :+1:
ahh nice! That is what I am looking for.
Only place I didn't look to see about the virtual scrolling was in the stories dir! :smile:
Thanks for the speedy response!
@ryanlanciaux is Infinite scroll already in Griddle? If yes, could you give me an example how to implement it.
Is there an example of how the infinite scroll works for Griddle 1.0 and above? The link for https://github.com/GriddleGriddle/Griddle/blob/master/stories/index.js#L260 it's broken now
@jrmartin Is there an example of how the infinite scroll works for Griddle 1.0 and above?
https://github.com/GriddleGriddle/Griddle/blob/2988f42dd4b3db027587694028783f6507e7848d/stories/index.js#L258-L267
can we call the API service to get more data on scroll, what I mean i will load first 100 records and on each scroll will call the API to get the next 50 records(101-150) and append to the grid, is there any way to do this.
can we call the API service to get more data on scroll, what I mean i will load first 100 records and on each scroll will call the API to get the next 50 records(101-150) and append to the grid, is there any way to do this.
That's not currently supported; PositionPlugin unfortunately depends on LocalPlugin. There's some discussion happening over here, if you want to help implement something: https://github.com/GriddleGriddle/Griddle/issues/795#issuecomment-373708306.
Is there any way to get the onscroll event handler in the griddle
Not without patching PositionPlugin, though adding a callback to its options should be pretty easy.
@dahlbyk is there any way to create our own custom plugin?
@dahlbyk is there any way to create our own custom plugin?
Absolutely. A plugin is just an object that includes one or more of the following:
components: an object that includes new or replacement componentsevents: callbacks for pagination/sorting/filtering (not particularly well defined)reducer: object with reducer functions (keyed by action name)selectors: data selectors from state to get props for components (used with Reselect)settingsComponentObjects: object to customize settings componentsstyleConfig: object to customizeicons,classNamesandstylesinitialState: values to merge into the initial internal statelisteners: internal Redux store listenersreduxMiddleware: middleware for the internal Redux store
"Patching" PositionPlugin could be as simple as calling the exported plugins.PositionPlugin function and then overriding selectors and maybe a few components with your modifications.
@dahlbyk thank you very much for update :)
@dahlbyk i am creating a custom plugin, i have some requirement to pass some parameter for my custom plugin is there any way to pass the parameter for custom plugins?
@sansetty2510 that's how the PositionPlugin works: we export a constructor function that accepts plugin config, and that function returns the plugin object used by Griddle:
<Griddle data={...} plugins={[PositionPlugin({ config goes here })]) />
@dahlbyk how to access that 'config' parameter in my custom plugin, for example i am using components->Layout the layout component i am enhancing, i want to access that 'config' parameter in my Layout class. How to do it. I just created a function that can access the 'config' data, but i am unable to pass it for my layout component.
I would mimic how PositionPlugin handles config: it merges the values into initialState.positionSettings and uses selectors to make the values available to components in TableEnhancer. You would use a similar technique with a LayoutEnhancer.
@dahlbyk I have implemented the infinite scroll by calling the services based on the user actions by creating the custom plugin, but I am facing one issue like the screen is getting flickering on some position of scroll, I debug the issue I came to know that if we are using 'PositionPlugin' in the 'tbody' by default one row(tr) is getting created and on each scroll the height of that 'tr' is changing in some position of scroll bar the value is keeping on updating and not stooping by this reason screen is getting flickering... please suggest me how to fix this issue.
(Comment moved to https://github.com/GriddleGriddle/Griddle/issues/814#issuecomment-386295655)