How do I assign search value with javascript?
How do I assign search value with javascript?
rbyrns
Posts: 36Questions: 9Answers: 0
Trying to do a date range search - I got the idea that I could use 2 datepickers to pick the range and just put the 2 dates into the
columns.[9].search.value and just redraw. I can catch in on the server side and parse out the two with a delimiter (X in this case), get the data and send it back. I tried
$( "#min" ).datepicker( {
"dateFormat": "yy-mm-dd",
"onSelect": function(date) {
min = new Date(date).getTime();
this.table.columns(["9"]["search"]["value"])=min+"X";
table.draw();
}
I get invalid left hand assignment errors unless I add "==" instead of just "=". What rule am I breaking here?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Bottom line is that I need a date range filter that is server side. I tried yadcf but the date format YYYY-mm-dd won't work, and I don't know enough about java to translate the server-side example to php.
I'm assuming you are using server-side processing from your comment? If so, then I would suggest using the
column().search()
API method to set the value. At the moment I'm not actually sure what would happen (syntax error perhaps?) when passing three nested arrays into thecolumns()
selector!So you would use:
Allan
Thanks, I will go back and try this.