简体   繁体   中英

Search By date in jqgrid Search Toolbar not working

I am using Jqgrid with Asp.net. I am trying to implement Toolbar Search . Every Field is searchable but Date search is not working.. I seen some example and they are working because they are using local data and date formate in source is 2012/02/02 . But I am fetching data directly from data base so Plz Help me to fix this problem.

Here is my Date Col module

               name:'Date',
               index:'Date',                                                                                  
               align:"center",
               formatter:'date',                                                                 
               formatoptions: {newformat:'m/d/Y'},                               
               searchoptions: 
               {sopt: ['eq','ne'],
               dataInit : function (elem) {
$(elem).datepicker({ changeYear: true, changeMonth: true,  showButtonPanel: true});
                                        }}

You should use additional property sorttype: "date" in the definition of the column 'Date' . Moreover you should verify that the server return date values in correct format.

If you use only newformat property of formatoptions then jqGrid try to read the data in ISO 8601 format: "Ymd". If the server return date in another format you should describe the format with respect of additional srcformat property of formatoptions . For example srcformat: "m/d/Y" .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM