searching is not happening
searching is not happening

http://live.datatables.net/wilavabi/11/edit
I am providing the test case.
in the test case, on selecting the option in select dropdown
search should happen and table should show the results appropriately
This discussion has been closed.
Answers
In your event handler you have
var table =$('#profile-table').DataTable();
but your table ID isexample
. Here is the updated test case:http://live.datatables.net/wilavabi/12/edit
Your server script will need to handle the regex searching which the
/ssp/ids-objects.php
script does not so the search in the test case results in an error.Allan has told others that regex searching with SQL type databases is not recommended due to performance. That part is up to you to write and verify it works properly.
Kevin
sorry my bad, I have put it as server side , for client side how to handle it?
the same test case i want the search on client side.
Please help in this
I removed serverside and fixed this error:
Fixed it by adding a return after the if statement in the
columns.render
. You always need to return something.The search works here:
http://live.datatables.net/wilavabi/16/edit
Kevin
@kthorngren it is working here in the test case.
But i have built similar thing in my project.
it is not happening.
table.column(5).data().toArray(). -----> ["0abbc286-901a-40be-8cd9-a86d459df2b7"]
But on searching against this column it is not displaying the results.
i tried using the below code
table.column(5).search("^" + "0abbc286-901a-40be-8cd9-a86d459df2b7" + "(.)*", true, false).draw();
As it's working in Kevin's example, we'll need to see it. Can you link to your project, please.
Colin
table.column(5).data().toArray(). -----> ["0abbc286-901a-40be-8cd9-a86d459df2b7"]
it is returning this, so when i use
table.column(5).search("^" + "0abbc286-901a-40be-8cd9-a86d459df2b7" + "(.)*", true, false).draw();
it should search and show it right. Here am i missing anything?
Use https://regex101.com/ to test your regex expressions. If they work but you aren't see the results then we will need to see a running example with the problem to help debug. Otherwise its impossible to guess what the problem might be.
Kevin
how to log and see the search results ?
http://live.datatables.net/wilavabi/18/edit
without regex is it not possible to search against a specific column?
You can use regex for a specific column, see the updated example:
http://live.datatables.net/nujibusa/1/edit
Change the drop down and you will see all columns the start with
S
.To see the searched data you will use
columns()
orrows()
with aselector-modifier
of{search: 'applied'}
with the chaineddata()
API. This is also in the example.Kevin
Thanks Kevin @kthorngren
Now i have another use case. where i have two filters on names and office columns.
wanted to perform search combining both the filters.
I tried using chaining but i am not getting correct results
in the test case on selecting name as "Airi" and office as "accountant" it is displaying 0 results instead of 1.
Please see the test case below
http://live.datatables.net/wilavabi/19/edit
You have a trailing space in your Accountant option:
Remove the space.
Kevin