Searching columns doesn't search for partial string matches
By default datatables has an 'advanced' search where you can search for partial string matches. I've noticed that it doesn't really work when using this library.
Is there a way to enable partial string searches?
Example:
Currently, if i search for "text" in ["example text"] it would yield no results but searching for "examp" would.
Could this be related to the filter_queryset(), specifically where you use 'istartwith' instead of 'icontains' ?
Comments (4)
-
repo owner -
If i wanted to disable the search functionally provided by filter_queryset() and use the one provided by the datatables library, would that be difficult to do?
-
repo owner You have to differentiate between server side and the client side. DataTables filtering is done in the browser (client side) so in order to do it, you need all the data loaded previously. If you're using server side processing then you have to handle filtering separately from DataTables - on the server.
-
repo owner - changed status to closed
- Log in to comment
As you've noted it is a matter of istartswith. You can simply override filter_queryset() method in your descendant class and use icontains or anything you need.