vaadin / web-components

A set of high-quality standards based web components for enterprise web applications. Part of Vaadin 20+
https://vaadin.com/docs/latest/components
453 stars 83 forks source link

[grid] Add insert/update/delete support #1487

Open Jonno63 opened 5 years ago

Jonno63 commented 5 years ago

Description

Currently when using dataProvider to load grid data, there is no native support for insert/update/delete operations on grid data.

While,this can be achieved when using the items array to load data, this vaadin forum thread, https://vaadin.com/forum/thread/17445015/17445638, notes that the items array is intended for use with small numbers of records when the entire data set can be loaded directly.

The thread proposes a workaround but the grid would greatly benefit from native support for these operation in dataProvider mode thus retaining the lazy loading essential when dealing with a large number of records.

This thread also notes the refreshItem(T item) method of the Java component for updating items within a grid so perhaps something similar would work with corresponding methods to add and delete records too

In summary the feature request is to provide native support within grid methods to add,update and delete individual records and have these changes reflected in the UI.

web-padawan commented 5 years ago

The custom logic can be implemented to handle that, and we actually have 3 ways for editing data displayed as a grid at this time (all of those are built using different approaches):

The Pro web components are still not patching dataProvider logic internally but provide the events which the user could use to handle the application state updates accordingly.

So, we understand your feature request but in general there are ways to accomplish this using Vaadin platform now (although 2 of those are Pro components and require a subscription).

lycandroid commented 5 years ago

I'm not sure this answers the question. The question relates to arbitrary updates of data in the grid which do not necessarily occur through a user action. For example a server push may want to update a grid row.

Even if it is a user action it may be in some other part of the UI. Perhaps vaadin-crud can be used for that but does not really fit into a "pick-and-mix" web component environment where the "other part of the UI" may be a non-vaadin element.