Using kendoDateTimePicker's value to update kendoGrid dataSource filter isn't working

524 views Asked by At

I have a Kendo DateTime selector on a page, from which I take its value (instance of Date according to Kendo docs http://docs.kendoui.com/api/web/datetimepicker#methods-value), and then I'd like to insert it into a kendoGrid's dataSource filter.

The problem is, that it doesn't appear to be working... I've set up a demo here: there are 2x inputs, one for each column in the grid - when you click the go button those inputs are applied as filters to the grid. The text filter works, but the datetimepicker doesn't...

http://jsfiddle.net/gUF43/6/

// This line sets the filters - the text one is populated and datetime isn't :(
$("#thegrid").data('kendoGrid').dataSource.filter(filters);

At the end I'd expect the grid to show the populated filter when you click on it, but its empty which implies that it didn't like the date object.

What do you reckon? Thankyou.

2

There are 2 answers

5
Neil Kistner On BEST ANSWER

Working with your updated fiddle is very helpful. Working with my updated fiddle based on yours, if you update your input text to Hello and change the time picker to 10:30am you will see the filter is now working properly.

The field property below was set incorrectly.

    var filter = {
      field: 'Timestamp',
      operator: 'eq',
      value: val
    };

Updated Fiddle: http://jsfiddle.net/wyze/gUF43/7/

6
Craig Fetherling On

Looks like you need to new up the date like so: value: new Date().