Programmatic TableView Filter does not have any effect

Issue #843 new
Daniel Peintner
created an issue

I started to use the TableFilter class to filter rows. The filtering through the user interface works fine. Besides that I wanted to provide also filtering through my own widgets like buttons etc.

This programmatic filtering

tableFilter.selectValue(lastNameCol, "Smith");
tableFilter.executeFilter();

does not have any effect. Please find attached a complete example that should illustrate the issue. According to my understanding by pressing the button in the example it should filter all persons with lastName "Smith" but it does not have any effect.

Is my approach wrong?

Thanks,

-- Daniel

P.S: I believe the maintainer is Thomas Nield but I don't know how to contact him differently

Comments (10)

  1. Thomas Nield

    Hi Daniel, I am sorry it took months to address this.

    I think there is a misunderstanding on how to use the API here.

    If your intention is to only have "Smith" selected, you need to unselectAllValues() first and then selectValue() on Smith.

    This allows multiple selections to be made.

    If we want to create a selectOnly() method, we can file a separate issue.

            Button bFilter = new Button("Filter Smith");
            bFilter.setOnAction(new EventHandler<ActionEvent>() {
                @Override public void handle(ActionEvent e) {
                    System.out.println("Filter Smith");
                    // XXX Does not have any effect!?
                    tableFilter.unSelectAllValues(lastNameCol);
                    tableFilter.selectValue(lastNameCol, "Smith");
                    tableFilter.executeFilter();
                }
            });
    
  2. Daniel Peintner reporter

    Hi Thomas,

    Thanks for the feedback. I did really "misunderstand" the API in that regard. Calling unselectAllValues() first did the trick.

    The only minor issue I noticed was that the filter icon is not showing up when doing the pragmatic filtering vs. the filtering through the table column.

    Thanks a lot!

    -- Daniel

  3. Thomas Nield

    I need to fix that icon issue too. Funny how I come around to addressing these issues when I have to dogfood them for my purposes.

    I'll see if I can set aside some time for that today (for real).

  4. Daniel Peintner reporter

    Hi Thomas.

    One more silly question. Is there a reason why TableFilter<T> is marked as final?

    The reason why I am asking is that I would like to filter entries in a table that have a relation. Meaning that a row might have a parent row without the filter matching. Still I would like to show the "parent" row.

    I believe one could do that by overriding the executeFilter() method but since the entire class is final this is not possible.

    Thanks for any advice!

    -- Daniel

  5. Log in to comment