Note that there are some explanatory texts on larger screens.

plurals
  1. POjqGrid filter or search by date not working client side
    primarykey
    data
    text
    <p>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:</p> <pre><code>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(); </code></pre> <p>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.</p> <p>So I dug deep into the jqGrid code, and here's what it generates before it searches:</p> <pre><code>{"groupOp":"AND","rules":[{"field":"blah","op":"bw","data":"11/17/2010"}]} </code></pre> <p>Eventually, when it goes through every row and it evaluates the operation on the field, the eval(m) &amp;&amp; p.push(this) line, m is this:</p> <pre><code>(String(this.blah).substr(0,10) == String("11/17/2010")) </code></pre> <p>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...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload