3

I have a jqgrid with a date column in it. But while doing the search operation on that date column, it doesn't yields any result, even though the data as per the search criteria is there in grid. I am unable to find out the problem why the search is not working on date column only in my jqGrid. Kindly help me out if anyone knows the reason behind search not working for date column. Any help is greatly appreciated.

Priya
  • 121
  • 1
  • 2
  • 16
  • 1
    Can you share your jqgrid code? – JGV May 20 '15 at 05:17
  • My colmodel for the date column is as under : `{key:false, name:'mydate',index:'mydate',sortable:true,editable:false,searchtype:"date",formatter:"date",formateoption:{newformat:'d/m/y'}}` – Priya May 20 '15 at 05:23
  • what is `searchtype`? You mean `sorttype`? Which `datatype` you have? Do you makes *local* search? Which input data you use? Which version of jqGrid you use? You should include much more information or better to provide the demo which demonstrates the problem. – Oleg May 20 '15 at 07:08
  • The searchtype is date and if I am not wrong its a jqGrids property. The datatype is datetime. Yes I do perform a local search for performing equals, less than, greater than operations within the grid data itself. The input data is ofcourse json. The jqgrid version used is 4.4.4. I would try to prepare a demo if possible in the fiddle. Hope this information helps. – Priya May 20 '15 at 07:28
  • There are no `searchtype` property in `colModel` (see [here](http://www.trirand.com/jqgridwiki/doku.php?id=wiki:colmodel_options)). `datatype` describe the type of input data of the grid. It can be `"local"`, `"json"`, `"xml"`, `"jsonstring"`, `"xmlstring"`, but not `"datetime"`. The version 4.4.4 is really **very old**. More recent versions have *absolutely another parsing and formatting of dates*. I strictly recommend you update jqGrid to [free jqGrid](https://github.com/free-jqgrid/jqGrid) for example. The demo is really required. – Oleg May 20 '15 at 08:13

1 Answers1

0

If you share your colModel code, It would be easy to understand the problem

Try replacing your colModel like this:

{ name: 'date', sortable: true, sortorder: "ASC", sorttype:"date", editable: false, formatter: 'date', formatoptions: { srcformat: 'd-m-Y', newformat: 'd-m-Y' }},
siva
  • 525
  • 2
  • 14