Filtering by the variables I send with the get method
Filtering by the variables I send with the get method
emrahozsahin
Posts: 8Questions: 1Answers: 0
I have variables that I created with preg match in index.php. When I click on these links, I want the results to be filtered with data tables. I can list all the results, but how can I get it to filter by the data sent with get ?
Replies
I'm not sure I understand what you are looking for. Maybe you are looking to use
ajax.data
as a function, like this example to send the search parameters to the server. Or are you looking for deep linking into the Datatable?If these don't help then please provide more details of your requirements.
Kevin
Yes, something similar to that I was talking about. I want to filter by button click according to different Where conditions.
When I click on the fixed buttons, I want to list by sending parameters according to more than one condition. I want to create fixed search patterns instead of typing the search text.
For example index.php
<a href="....com/ajax.php?categoryID=4&country=brighton">
<a href="....com/ajax.php?categoryID=3&country=london">
Results
4-Brighton
4-Brighton
4-Brighton
Results
3-London
3-London
3-London
Just use the SearchBuilder.
https://datatables.net/extensions/searchbuilder/
Even though I add the required criteria, it doesn't give any results. Lists all data
It seems that the search conditions cannot be transmitted.
https://live.datatables.net/qoliyehi/15/edit
When I compare it with the one in this link, the parameters I wrote to the search filters do not appear here, even though I apply the same code.
my code
Working example
The only thing I can think of is you are not loading the SearchBuilder library or its being loaded at the wrong time. Also make sure you have the latest version of SearchBuilder loaded. Anything before SearchBuilder 1.2.0 didn't support server side processing.
If none of these help then please post a link to your page or a test case replicating the issue so we can help debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
https://live.datatables.net/qoliyehi/38/edit
objects.php
https://github.com/DataTables/DataTables/blob/master/examples/server_side/scripts/objects.php
I am using the objects.php file in this link
https://github.com/DataTables/DataTables/blob/master/examples/server_side/scripts/ssp.class.php
I am using the ssp.class.php file in this link
There is a structure consisting of a total of 650.000 data and 23 columns.
The test case is working. The server scripts won't affect the client side SearchBuilder's ability to send the parameters. To help debug we will need to see the running problem.
Have you validated the version of SearchBuilder you are using?
Kevin
Post your Datatables init code. Maybe something is wrong there.
Kevin
https://we.tl/t-tTqIEGl9UQ?utm_campaign=TRN_TDL_05&utm_source=sendgrid&utm_medium=email&trk=TRN_TDL_05
I started from the beginning to work on localhost according to the original codes. But here, too, I could not succeed. I am sending all the codes in their original form.
I just realized you are using the
ssp.class.php
library. This does not support the additional SearchBuilder parameters sent. However you should see the parameters sent in your browser's network inspector.You can use the Editor server side library which does support SearchBuilder. See the SearchBuilder docs for more info. See this blog for how to use the Editor server side library.
Kevin
I noticed that you aren't displaying the SearchBuilder interface. If this is the case then maybe
search.search
orsearchCols
will fit your needs and will work with thessp.class.php
script.Kevin