How do I assign search value with javascript?

How do I assign search value with javascript?

rbyrnsrbyrns Posts: 36Questions: 9Answers: 0
edited December 2014 in Free community support

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

Answers

  • rbyrnsrbyrns Posts: 36Questions: 9Answers: 0
    edited December 2014

    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.

  • allanallan Posts: 63,695Questions: 1Answers: 10,500 Site admin
    Answer ✓

    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 the columns() selector!

    So you would use:

    this.table.column( 9 ).search( min+"X" ).draw();
    

    Allan

  • rbyrnsrbyrns Posts: 36Questions: 9Answers: 0

    Thanks, I will go back and try this.

This discussion has been closed.