Search code examples
javascriptjqueryjqgridfree-jqgrid

JQGrid - Date filter is not working with date format (Date(1453636335000))


I am passing JSONstring to the JQGrid. Everything is working fine except date filter. Please find JSFiddle demo here.Please help me out to resolve this issue. Tried all possible options but nothing worked for me.

Thanks


Solution

  • The problem exist because of missing property

    sorttype: 'date'
    

    in the column which uses formatter: "date". The name of sorttype property is misunderstandable, but it will be used for both sorting and filtering. If sorttype: 'date' exist then the data from the column will be converted to the date value before comparing. Your original code use the statement like

    (String(jQuery.jgrid.getAccessor(this,'CheckinsNoCodeReview_CreatedDate')).toUpperCase() == String("01/24/2016").toUpperCase())
    

    for the filtering. After adding sorttype: 'date' it will be changed to

    (jQuery.jgrid.parseDateToNumber.call(jQuery("#grid")[0],"Y-m-d",jQuery.jgrid.getAccessor(this,'CheckinsNoCodeReview_CreatedDate')) == 1453590000000)
    

    and it works.

    See the modified demo http://jsfiddle.net/OlegKi/zevpmrL2/7/