.search().draw() - Custom Date Filter
.search().draw() - Custom Date Filter
goktuginal41@gmail.com
Posts: 57Questions: 22Answers: 0
Hello everyone,
I have custom date filter. I want to see the rows between min and max dates on the screen. I'm using server-side processing. When I search for a certain value, I can write it in the search function and display the table, but how can I use the search function between two dates? Thanks in advance.
var min = new Date()
var max = new Date()
$('#search_date').click(function () {
dtable.column(1).search().draw()
});
This question has accepted answers - jump to:
Answers
Try this Date range search plugin. You can see a running example of numeric range search here.
Kevin
As I know, DataTable.ext.search.push function is not working with server side processing, no?
You are correct, that is for client side processing. You can send the date range values using
ajax.data
as shown in this example. You can use justdraw()
to have a server side processing request sent to the server, for example:You server script will need to fetch the parameters sent via
ajax.data
to filter the search results.Kevin
Thank you. It really helped me. I have one more question. How can I call d.myKey parameter in click function?
You wouldn't access the
d.myKey
value within your Javascript code. It is a parameter sent viaajax
to the server. If you have two date range inputs, similar to this example you would access them using something this$("#min").val();
. Yourajax
option would look like this:In your click function you will access the values using
$('#min').val();
and$('#max').val();
.Kevin