JQGrid搜索按钮不起作用

时间:2015-01-16 15:56:27

标签: javascript jquery jqgrid

我有一个JQgrid,我试图将datepicker放入我的一个colmodel中 如

colModel: [{
    name: 'Business Date',
    index: 'Business Date',
    width: 90,
    sorttype: 'string',
    align: 'center',
    datefmt: 'Y-m-d',
    editable: true,
    search: true,
    stype: 'text',
    searchoptions: {
        dataInit: function(elem) {
            /*jQuery*/
            $(elem).datepicker({
                showButtonPanel: true,
                changeMonth: true,
                changeYear: true

            });
        }
    }
}]

这是我的navgrid

navGrid('#pager', {
    edit: false,
    add: false,
    del: false,
    search: true,
    refresh: true
});

另外,这是我的jQgrid配置

<script src="./scripts/common.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript" src="./scripts/jquery-1.6.3.js"></script>
<script type="text/javascript" language="javascript" src="./scripts/grid.locale-en.js"></script>
<script type="text/javascript" language="javascript" src="./scripts/jquery.jqGrid.min.js"></script>

<link href="./css/redmond/jquery-ui-1.10.3.custom.css" rel="stylesheet" type="text/css"/>
<link href="./css/ui.jqgrid.css" rel="stylesheet" type="text/css" />

现在,当我点击搜索按钮时,没有任何反应。有没有办法通过在某处发出警报来找出搜索按钮尝试做什么?如何访问搜索按钮的实际功能定义?我还有一些其他屏幕在searchoptions colmodel中没有datepicker,但搜索似乎工作正常。我的语法有问题吗?

修改

这是整个网格代码

    /*Grid Code*/

jQuery(document).ready(function(){ 



     jQuery("#list").jqGrid({
     datatype: 'json',
    url:'feeder.jsp?deskName=<%= request.getParameter("deskName")%>&ctlSelectedDate=<%= request.getParameter("businessdate")%>',

     colNames: ['Business Date','T','T Date','S Date','S Name',
     'C','R/D','CTP Amt','R Par','Extrnl T',
     'GC Acct','GC Name','C Acct','Ct Acct','Ct Name'],
     colModel: [

         {
                  name: 'Business Date', index: 'Business Date', width: 90, sorttype: 'string', align: 'center',datefmt: 'Y-m-d',
                  editable:true,
                 search:true, stype:'text',

                 searchoptions:{
                     dataInit:function(elem)
                          {
                             jQuery(elem).datepicker({
                                     showButtonPanel: true,
                                     changeMonth: true,
                                     changeYear: true

                             });
                          }
                      }

              },

              {
                 name: 'T', index: 'T', width: 50, align: 'center', sorttype: 'string', editable:true,
                 search:true, stype:'text'
              },


      {
                  name: 'T Date', index: 'T Date', width: 80, align: 'center', sorttype: 'string', editable:true,
                  search:true, stype:'text',
                   searchoptions:{
                     dataInit:function(elem)
                          {
                             jQuery$(elem).datepicker({
                                     showButtonPanel: true,
                                     changeMonth: true,
                                     changeYear: true

                             });
                          }
                      }
              },



              {
                   name: 'S Date', index: 'S Date', width: 80, align: 'center', sorttype: 'string', editable:true,
                   search:true, stype:'text',
                    searchoptions:{
                     dataInit:function(elem)
                          {
                             jQuery(elem).datepicker({
                                     showButtonPanel: true,
                                     changeMonth: true,
                                     changeYear: true

                             });
                          }
                      }
              },

              {
                   name: 'S Name', index: 'S Name', width: 140, align: 'center', sorttype: 'string', editable:true,
                   search:true, stype:'text'
              },
              {
                   name: 'C', index: 'C', width: 75, align: 'center', sorttype: 'string', editable:true,
                   search:true, stype:'text'
              },
              {
                   name: 'R/D', index: 'R/D', width: 50, align: 'center', sorttype: 'string', editable:true,
                   search:true, stype:'text'
              },{
                   name: 'CTP Amt', index: 'CTP Amt', width: 110, align: 'right', sorttype: 'float', editable:true,
                   search:true, stype:'float'
              },{
                   name: 'R Par', index: 'R Par', width: 100, align: 'right', sorttype: 'float', editable:true,
                   search:true, stype:'text'
              },{
                   name: 'Extnl T', index: 'Extnl T', width: 90, align: 'center', sorttype: 'string', editable:true,
                   search:true, stype:'text'
              },{
                   name: 'GC Acct', index: 'GC Acct', width: 90, align: 'center', sorttype: 'string', editable:true,
                   search:true, stype:'text'
              },{
                   name: 'GC Name', index: 'GC Name', width: 150, align: 'center', sorttype: 'string', editable:true,
                   search:true, stype:'text'
              },{
                   name: 'C Acct', index: 'C Acct', width: 60, align: 'center', sorttype: 'string', editable:true,
                   search:true, stype:'text'
              },{
                   name: 'Ct Acct', index: 'Ct Acct', width: 60, align: 'center', sorttype: 'string', editable:true,
                   search:true, stype:'text'
              },
              {
                   name: 'Ct Name', index: 'Ct Name', width: 150, align: 'center', sorttype: 'string', editable:true,
                   search:true, stype:'text'
              }
       ],

      pager: "#pager",      
      rowNum: 500,          
      rowList: [500,1000, 2000, 3000,4000], 
      shrinkToFit:false,
      sortorder: "asc",
      viewrecords: true, 
      gridview: true,   
      autoencode: true,
      height:450, 
      ignoreCase:true,
      multiselect:false,    
      multiboxonly: true,
      loadonce:true, 
      caption:"grid", 
      width:1030
      }).navGrid('#pager',{edit:false,add:false,del:false,search:true,refresh:true}).jqGrid('navButtonAdd',
                '#pager',
                { caption: " Export to Excel ",
                   position: "last",
                   onClickButton: function(){
                   jQuery("#list").jqGrid('excelExport',
                        {
                    "url":"excelreporter.jsp?AppName=report&dN=<%= request.getParameter("dN")%>&BSNS_DT=<%= request.getParameter("businessdate")%>"
                       });

                   }
                });
 }); 

由于

0 个答案:

没有答案