简体   繁体   中英

Make specific columns of a Grid editable in Vaadin 8

In Vaadin 8, I have a Grid with columns and rows populated from jsondata using setDataProvider . Now, I have an edit button, upon clicking it user should be able to edit (a few) columns in the Grid .

In Vaadin 8, there are number of ways to incorporate editing in Grid.

There is a builtin feature of row editor, which can be used also in unbuffered mode. This is not equivalent of having the whole column editable, but mimics it pretty well, while you can use Binder for setting fields, validation, etc. There exists also an add-on that helps keyboard navigation with un-buffered editor.

Alternatively you can use the Grid Renderers Collection add-on , that provides set of editable renderers with edit events etc.. This is literaly what you are looking for, column oriented editing. This is useful approach when only few columns are editable.

https://vaadin.com/directory/component/grid-renderers-collection-for-vaadin7

If you use renderers extensively, there will be more widgets for the browser to render, and that will UI possibly slower than using eg row editor in un-buffered mode. This depends heavily on your application and use case. I recommend to study multiple approaches and select the one that fits you the best.

Third alternative is to use ComponentColumn feature, see chapter Component Renderer in Vaadin documentation . This is somewhat easier than implementing custom renderers, but adds some further overhead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM