1 Reply Latest reply: Dec 13, 2013 12:18 PM by user10878887 RSS

    RowFilter not filtering

    user10878887

      I have this code that should filter a table rows, but it doesn't filter

       

      { code }

      TableRowSorter<TableModel> sorterAS = new TableRowSorter<>(treeTable.getModel());

      RowFilter<TableModel,Object> filterAS = new RowFilter<TableModel,Object>() {

          @Override

          public boolean include(RowFilter.Entry<? extends TableModel, ? extends Object> entry) {

              if(entry.getStringValue(2)==null || entry.getStringValue(2).equals("")) {

                  return false;

              } else {

                  System.out.println("entry.getStringValue(2) "+entry.getStringValue(2));

                  int onCerere = Integer.parseInt(entry.getStringValue(2).toString());

                  if (onCerere==1) {

                      System.out.println("onCerere = 1");

                      return true;

                  } else {

                      System.out.println("onCerere = 0");

                      return false;

                  }

              }

          }

      };

      sorterAS.setRowFilter(filterAS);

      treeTable.setRowSorter(sorterAS);

      { code }

       

      The function returns true and false but all rows are displyed.

       

      Thank you.