Is there a way to show in the SearchBuilder only values currently visible in the table?

Is there a way to show in the SearchBuilder only values currently visible in the table?

Wizard85Wizard85 Posts: 9Questions: 2Answers: 0

I mean every time a condition is applied, the VALUES of the next condition should only contains the one available in the rows visible, not all the possible values (similar to excel filtering)

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,144Questions: 1Answers: 2,586

    No, SearchPanes does that, but not SearchBuilder. The main reason is that you can apply OR logic to SearchBuilder, so you may want to see those values which have been filtered out.

    Colin

  • Wizard85Wizard85 Posts: 9Questions: 2Answers: 0
    edited January 2021

    @colin thanks, I understand that.

    What about with select filters? It is possible to customize in some way to have "depended" conditions?
    In my scenario I have a table with several columns, and on top of each column I have a dropdown filter.
    But I want that on every change of a filter, the options on the other filters are updated according. At the moment I implemented a custom logic with jquery, but it's not very fast (I have 40 filters).

  • colincolin Posts: 15,144Questions: 1Answers: 2,586

    No, that's not possible, I'm afraid. The select options are all created when the Searchbuilder extension is initialised - they can't be changed afterwards. I'll post this to the team and see if they have any suggestions.

    Colin

  • kthorngrenkthorngren Posts: 20,308Questions: 26Answers: 4,769
    Answer ✓

    I have a table with several columns, and on top of each column I have a dropdown filter.

    This example, which can be found in other threads, shows how to cascade select lists.
    http://live.datatables.net/gejojiqu/1/edit

    Kevin

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi @Wizard85 ,

    I think Kevin has probably answered your second question about select filters, so thanks to him for that.

    I'm just going to follow up on Colins points about SearchBuilder. The combination of changing logic and nested groups in SearchBuilder are really what stops us from doing this.

    Say for example you had a top level group with or logic and then a bunch of sub groups with and logic. Each of those sub groups would have to calculate it's own cascading options which is going to be computationally expensive, especially with larger tables. searchPanes.cascadePanes is one of the biggest performance drains for SearchPanes at the moment with really large datasets. And that is only with one grouping. With SB the more groups are added the more complex the logic needs to get and in turn the slower it will become.

    As I mentioned before though, we've discussed it before and have a ticket for it. So it might happen one day, but at the moment there are other things that are higher priority.

    Thanks,
    Sandy

  • Wizard85Wizard85 Posts: 9Questions: 2Answers: 0

    @kthorngren I tried that example, but since I have an ajax call, that function "buildSelect" isn't called on the right time and sometimes filters are all empty or broken

  • kthorngrenkthorngren Posts: 20,308Questions: 26Answers: 4,769
    edited January 2021

    Using ajax doesn't affect the buildSelect function as shown in this example with ajax:
    http://live.datatables.net/gejojiqu/1149/edit

    However if you are using server side process ( serverSide ) then this solution will only show the options that are in the client, ie, the current page of data.

    If you aren't using server side processing then please provide a link to your page or update the test case to show the issue so we can help debug.

    Kevin

This discussion has been closed.