Gird - Prevent editing of certain Items

Hello,

is it possible to prevent the editing for certain item ids?

Something like

grid.setItemEditable(itemId, false);

Thank you already!

Hi,

Never tried but implementing your own DefaultEditorEventHandler should do the job :

https://vaadin.com/api/7.6.4/com/vaadin/client/widget/grid/DefaultEditorEventHandler.html#handleOpenEvent(com.vaadin.client.widgets.Grid.EditorDomEvent)

Regards

Yeah, I usually use this:

Grid grid = new Grid(beanItemContainer);
grid.getColumn("beanFieldName").setEditable(false)

Thank you for your suggestion. So as far as I can see I have to replace this handler on the client side, extend the grid and create a custom grid for it, correct?

I think I will create an enhancement request for this, as I think this is a common use case that one wants to prevent editing of certain items.

@Alisa Lee:
This only prevents the editing of a certain column (property) not row (item).

Hello,

You do not need to extend Grid nor create a custom grid. you need to extend DefaultEditorEventHnadler and make a grid.setEditorEventHandler() with your own class

Regards