Grid filter

I create one grid:

Grid myGrid = new Grid()

how can I filter this grid? I try to use myGrid.getDataProvider() but don`t have the setFilter method


I think you have to instantiate a ListDataProvider, set that as the grid’s data provider, and filter the ListDataProvider.

Grid myGrid = new Grid<MyObj>();
ListDataProvider<MyObj> dataProvider = new ListDataProvider<PermissionCode>(permissionCodes);
String filterString = "Test";

//Filter - attach to a TextField when value changed or on a button
if (filterString.length() > 0) {
  dataProvider.setFilter(MyObj::name, s -> { // where name is a field in your MyObj
  return s.toLowerCase().contains(filterString.toLowerCase());