Functionality to clone the GRID?

Sometimes it is possible to have a complex grid, but it would be very nice to have some functionality to copy/duplicate it to other Grids as well.

Is it possible ? Or should we just do it with the grid providers ?

The way I see it, there are two quite separate things in a Grid: Configuration and Data. Configuration (columns definitions, tooltip generators, part name generators, context menu configuration etc.) is easy to reproduce because you can just create a method that does all that configuration.

Data, on the other hand, is not at all tied to the Grid - it’s just Java objects. You can even put the same Java Container into multiple Grids, no problems.

The only other thing is filtering and sorting. That you’ll need to keep track of, but given that you can share the data, applying the same filters shouldn’t be a problem. The DataView API also has the getItems() method if you want to get the filtered and sorted data of the Grid only into the other Grid.

1 Like

thanks Olli, I’ll take a look

I’ve prepared a ticket for extending Grid with a export API, also added the cloning case there - Grid data export API · Issue #7196 · vaadin/platform · GitHub. Take a look if you’re interested.

1 Like

ohhh, soo cool… thanks a lot…

1 Like