Grid support up or down arrow

How do I support up or down arrow with Vaadin 7 Grid? In the Table component, I could do something like the below, just don’t know how to do it with Grid. I know if I call setEditorBuffered(false), it will go to the next line when I click key. But if I have setEditorBuffered(true), it just closes the editor but does not go to the next line.

	private void downOneLine() {
		Object nextLine = table.nextItemId(table.getValue());

		if( nextLine == null )
		{

		}

		if( nextLine != null )
		{
			table.setValue(nextLine);
		}
		else
		{
			table.setValue(null);
		}
	}

	private void upOneLine() {
		Object prevLine = table.prevItemId(table.getValue());

		if( prevLine == null )
		{
		}

		if( prevLine != null )
		{
			table.setValue(prevLine);
		}
		else
		{
			table.setValue(null);
		}
	}

Sounds like you might benefit from this add-on: https://vaadin.com/directory/component/gridfastnavigation-add-on

Thanks, and the demo at https://github.com/TatuLund/GridFastNavigation/blob/master/GridFastNavigation-demo/src/main/java/org/vaadin/patrik/demo/DemoUI.java seems quite doable and does exactly what I want. One clarifying question: where is the best place to save to the backend, which event? From the demo, it looks like maybe RowEditListener is a good fit for that, just confirming. I don’t need it yet for this screen, just asking on the off chance my boss wants to get rid of “Buffered” mode from all our grids.

History and more information:

In table code, since I used shortcut listeners, I could do any backend updates in those listeners. And for Grid where buffered mode is turned on, I can do it when “Save” is clicked in grid.getEditorFieldGroup().addCommitHandler(new CommitHandler()...);. I think, with the FastNavigation add-on, I can do it in RowEditListener or CellEditListener. Hopefully I am correct.

where is the best place to save to the backend, which event? From the demo, it looks like maybe RowEditListener is a good fit for that, just confirming.

Yes, that is exactly the purpose of the event.

I disabled the following:

		fastGridNav.setOpenEditorWithSingleClick(false);
		fastGridNav.setOpenEditorOnTyping(false);

So why, if I happen to have a cell selected, does it still enter edit mode if I click “Enter”? Am I doing something wrong?

Basically, my code does this:

	private void selectItemFromGrid( ItemClickEvent event ) {
		if (gridComponent.isEditorEnabled())
		{
			Object itemId = event.getItemId();
			
			if( canEditCsvLine(itemId)	&& EDITABLE_COLUMNS != null && EDITABLE_COLUMNS.length > 0 )
			{
				gridComponent.editItem(itemId);	
			}
		}
	}
	
	ItemClickListener click = e->selectItemFromGrid(e);
	grid.addItemClickListener(click);

I do this for two reasons:

  1. To open the editor on one click (not needed with FastNavGrid, of course, but this was the original reason)
  2. To NOT open the editor in certain strange cases, like permission level things

Since I could not see how to do number 2 with FastNavGrid, I figured I would just use the code I know works. But then I had this “Enter” problem. So any other ideas would be appreciated. Thanks.