range search- filter in server-side generated table
range search- filter in server-side generated table
Lerster
Posts: 21Questions: 5Answers: 0
Hello,
I want to use the "Custom filtering - range search" in my ajax server-sided generated table.
This is the example-page:
https://datatables.net/examples/plug-ins/range_filtering.html
As you see in this test case it doesn´t work. The "salary" range search doesn´t react:
http://live.datatables.net/kadomira/1/edit
Thanks for help.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
When
serverSide
is enabled, all search (and ordering and paging) is performed by the script on the server, the client only displays the data returned. Because of that, your custom search won't be called, you'll need that functionality on the server.Colin
I´ve searched a lot but I can´t find an example how to do a range search server sided. Do you have an example for me so that I´ve a starting point?
There are a few threads on the forum discussing this - such as here and here, and this SO thread,
Colin
So I gave my best, but it´s a bit complicated.
This is my try. In the **function ( m ) {} **I try to send the maxid and minid to the getData.php
I think I need to catch these variables now in the getData.php in an array and make a mysql query to my database with the condition.
Since I want to be able to range sort the column "id" of my table "item_classes" it would look something like
But I don´t know how to handle it in the getData.php
You can't do it with the
SSP::simple
method. You'd need to use something like:This is a case where it might be easier to use Editor's PHP libraries.
If you do use the
SSP
script like that, then for goodness sake, make sure you validateminid
andmaxid
as numbers. Otherwise you leave yourself open to SQL injection attacks (another reason the Editor PHP libraries would be preferable here).Allan