Vaadin12 Grid setColumnReorderingAllowed

Hi,

may it’s a stupid question, but i setColumnReorderingAllowed on true and the grid doesn’t change. No way I see to reorder the columns. Did i miss something?

Greetings

Andre

Same for editing-Mode.

I set grid.setEnabled(true); and set a EditorComponent for each column, but nothing happens when i double click. To be honestm the Vaadin 7 Grid was more intuitive to use. I think i miss an important step to understand the way Grid is working nowadays

What does your code look like? I am using vaadin 12 and have no problem re-ordering a grid’s columns. There is no visual indicator on the page that a column can be moved before grabbing a column. You just click and hold the mouse on the column title and move your mouse around.

From the Java code:

		Grid<String[]> grid2 = new Grid<>();
		grid2.setColumnReorderingAllowed(true);
		grid2.setHeightByRows(true);

		grid2.addColumn(t->t[0]
).setHeader("Name").setFlexGrow(1).setResizable(true);
		grid2.addColumn(t->t[1]
).setHeader("Other").setFlexGrow(1).setResizable(true);
		grid2.addItemDoubleClickListener(event -> Notification.show("double click "+event));

		grid2.setItems(new String[][]
 {
			{ "0-0","0-1" }, 
			{ "1-0","1-1" }, 
		});
		add(grid2);

I am using a seperate Grid-class. The init-Method looks like:

public void init() { 
	setSizeFull();
	setColumnReorderingAllowed(true);
	setEnabled(true);
		
	TemplateRenderer<Customer> withProperty = TemplateRenderer.<Customer> of("[[item.firstname]
] [[item.lastname]
] ")
		.withProperty("firstname", customer -> customer.getFirstName())
		.withProperty("lastname", customer -> customer.getLastName());
	addColumn(withProperty).setHeader("Name");
     
	withProperty = TemplateRenderer.<Customer> of("[[item.year]
]")
		.withProperty("year", customer -> customer.getBirthDate().getYear());
	addColumn(withProperty).setHeader("year");

	addColumn(Customer::getStatus).setHeader("Status");

	setSelectionMode(SelectionMode.SINGLE);

	getColumns().forEach(col -> { 
		col.setFlexGrow(0);
		col.setWidth("200px");
		col.setSortable(true);
		col.setEditorComponent(new TextField());
	});
}

I can’t hold the column. There is no way the column is moving.

If I use your code snippet resize and the double click event is working, but I can’t reorder the columns.

BTW: Using Vaadin 12.0.0