searchBuilder and search

searchBuilder and search

straetchstraetch Posts: 10Questions: 5Answers: 0

When I use an Equals condition in searchBuilder it used to work.
Then I introduced
search: { return: true}
to improve performance for my table with 14,000 entries, so a simple search is activated on ENTER.
Now the searchBuilder does not filter the data on an Equals condition any more. Hitting ENTER does not help.
Second problem: Because the search on Equals in searchBuilder does not work, I tried to remove the Equals condition from searchBuilder. With such a big table, the combobox becomes too long anyway. An Equals condition with a plain text box seems not available in DataTables.
However, following https://datatables.net/extensions/searchbuilder/customConditions#Removing-a-condition on condition '=' has no effect. Moreover the statement
delete $.fn.dataTable.SearchBuilder.conditions.num['='];
crashes datatables.
Using DataTables 2.2.2 and searchBuider 1.8.2 .

Answers

  • kthorngrenkthorngren Posts: 22,200Questions: 26Answers: 5,111
    edited May 4

    Interesting problem. I built a simple test case to show the issue:
    https://live.datatables.net/zulogebo/1/edit

    @allan will need to take a look.

    As a workaround, until there is a potential fix, you could remove the default search input using layout and add your own to replace it using the technique shown in this example. Create your own change event handler for the input to use search() o perform the search.

    Kevin

  • straetchstraetch Posts: 10Questions: 5Answers: 0

    In my opinion the integration of searchBuilder with Search has many advantages.
    search: { return: true}
    Is not only active in Search, but also in searchBuilder, preventing the filtering after each character typed in the value field of a searchBuilder filter rule (other than Equals). Exactly what I need to improve performance. So, replacing the standard Search with a custom solution, is not really an option.
    I noticed that an Equals rule does become active when adding a blank new filter rule. I will instruct my users to do that as a temporary measure until a better solution is available.

  • allanallan Posts: 64,829Questions: 1Answers: 10,731 Site admin

    Thank you for letting me know about this, and Kevin for the test case. I'll try to make to some time to dig into this in the next few weeks.

    Allan

  • straetchstraetch Posts: 10Questions: 5Answers: 0

    any news?
    chris

  • allanallan Posts: 64,829Questions: 1Answers: 10,731 Site admin

    I've just spent some time on it and committed a change which allows it to work as expected. Kevin's example with the nightly build now works.

    Allan

  • straetchstraetch Posts: 10Questions: 5Answers: 0

    Beautiful!

    One observation: if search is active and searchbuider is used with Condition = Equals then the list in the combo box is the total list, whereas one would expect that the list is limited to items within the scope of the search. Now, if one selects an item from the combo, it happens that the searchbuilder returns zero items.
    This is just a little annoyance.

    Many thanks for the nice work.
    Chris

  • allanallan Posts: 64,829Questions: 1Answers: 10,731 Site admin

    Hi Chris,

    Yeah, that's a good point. That's a limitation of SearchBuilder at the moment I'm afraid - I'll have a look in future and see what I can do about that.

    All the best,
    Allan

Sign In or Register to comment.