我尝试使用延迟加载的Vaadin网格。当我向网格添加过滤器时,在某些过滤器值处,我看到空行并获取java.lang.IndexOutOfBoundsException:toIndex = 45.以下是我的代码:
private TextField FilterProcessName= new TextField();
DataProvider<GeneralProcess,String> provider=
DataProvider.fromFilteringCallbacks(query->{
int offset = query.getOffset();
int limit = query.getLimit();
String filter = query.getFilter().orElse(null);
List<GeneralProcess> processes =
service.findAll(offset, limit,filter);
return processes.stream();
},
query -> service.count());
ConfigurableFilterDataProvider<GeneralProcess,Void,String> wrapper=
provider.withConfigurableFilter();
grid.setDataProvider(wrapper);
FilterProcessName.addValueChangeListener(event -> {
String filter = event.getValue();
if (filter.trim().isEmpty()) {
filter = null;
}
wrapper.setFilter(filter);
grid.getDataProvider().refreshAll();
});
以下是来自UI的代码:
element.add();
当过滤器值非常窄并且网格中应该只有几行时,会出现问题。请任何帮助