Changing grid's drop mode dynamically disables drag and drop filters
tomivirkki opened this issue · 0 comments
tomivirkki commented
Description
Changing grid's drop mode dynamically disables drag and drop filters.
Expected outcome
The filters should work even after changing the drop mode
Minimal reproducible example
package com.vaadin.flow.component.grid.it;
import com.vaadin.flow.data.bean.Person;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.grid.dnd.GridDropMode;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.router.Route;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
@Route("repro")
public class Repro extends Div {
private Person draggedItem;
public Repro() {
var grid = new Grid<>(Person.class);
var people = IntStream.range(0, 220)
.mapToObj(i -> new Person("Changed " + i, 1 + i))
.collect(Collectors.toList());
grid.setItems(people);
grid.setRowsDraggable(true);
// Disallow dropping on top of items with age > 4
grid.setDropFilter(item -> item.getAge() <= 4);
grid.addDragStartListener(
e -> {
draggedItem = e.getDraggedItems().get(0);
grid.setDropMode(GridDropMode.ON_TOP);
// Workaround:
// grid.getDataCommunicator().reset();
});
grid.addDragEndListener(e -> {
draggedItem = null;
grid.setDropMode(null);
});
add(grid);
}
}
Steps to reproduce
- Open the example
- Try dragging rows over rows with age > 4
- Dropping is allowed while it shouldn't be
Environment
Vaadin version(s): 24
Browsers
Issue is not browser related