I have an ASP.NET MVC 3 page. On it, I have a table which I turn into a jqGrid using JSON data from an ajax call. The grid has the following setup:
myGrid = $('#myGrid');
myGrid.jqGrid({
caption: 'My Grid',
datatype: 'local',
data: data.rows,
height: 250,
pager: '#myPager',
viewrecords: true,
colModel: [
...,
{
label: 'blah',
name: 'blah',
align: 'left',
sortable: true,
editable: false,
width: 85,
formatter: 'date',
sorttype: 'date',
datefmt: 'm/d/Y',
formatoptions: { srcformat: 'm/d/Y', newformat: 'm/d/Y' }
},
...
]
});
// turn on filter toolbar
myGrid.filterToolbar();
data.rows is returned from the ajax call. This works in all ways except one. I can paginate client-side, sort client side, and search by every field except the one I show the colModel for. This 'blah' field is a date field, and it displays the dates correctly, in mm/dd/yyyy format. However, when I type in something like 11/17/2010 into the toolbar and press enter, the search returns 0 records.
So I dug deep into the jqGrid code, and here's what it generates before it searches:
{"groupOp":"AND","rules":[{"field":"blah","op":"bw","data":"11/17/2010"}]}
Eventually, when it goes through every row and it evaluates the operation on the field, the eval(m) && p.push(this) line, m is this:
(String(this.blah).substr(0,10) == String("11/17/2010"))
Basically, it looks to me like it's not recognizing that the field is a date. It calls parse instead of parseDate. Anybody have any ideas how to fix this? I know searching server side is easy, I can just pass that string, parse it, and bam. But I'd like to stay client side if I can. I was able to duplicate this in some of the samples that Oleg and Tom put up, so it's either an issue or I'm missing something in the configuration...