maimArt / TableFilterFX

An extension of JavaFX TableViews for filtering columns

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TableFilterFX

An extension for the JavaFX TableView that adds the possibility of applying a filter to the column headers

Travis Build Status

Maven Central

Hex.pm

screenshot1

Maven dependency

<dependency>
        <groupId>com.github.maimart</groupId>
        <artifactId>TableFilterFX</artifactId>
        <version>1.0.0</version>
</dependency>

Implementation

The implementation of the filter is quite easy. You wrap your TableView with the TableFilter and add the columns that should be filterd by tableFilter.filterColumn(TableColumn column)

######1 Build your TableView like usual by code or fxml

TableView<Pojo> table = new TableView<>();
table.getItems().addAll(pojoList);
TableColumn<Pojo, String> columnA = new TableColumn<>("ColA");
TableColumn<Pojo, String> columnB = new TableColumn<>("ColB");
table.getColumns().add(columnA);
table.getColumns().add(columnB);	
..

######2 After that apply the filter

TableFilter<Pojo> tableFilter = new TableFilter<>(table);
tableFilter.filterColumn(columnA);
tableFilter.filterColumn(columnB);

❕ You can initialize the table data by using TableView.getItems(), but you must not bind the TableView.itemsProperty(). If you want to bind the table data use the TableFilter.unfilteredItemsProperty() instead.

TODOs

This is a early version of the filter. If you find any bugs please feel free to create an issue. I´m glad to every reported bug.

  • Deployment on center maven repository will come soon
  • Improve performance on big lists (10k+)
  • Intensive testing of the filter will happen in nearest future

About

An extension of JavaFX TableViews for filtering columns

License:Apache License 2.0


Languages

Language:Java 95.4%Language:CSS 4.6%