jqGrid搜索抛出异常

时间:2011-04-11 06:50:01

标签: javascript jquery jqgrid

我正在使用jquery和jqGrid插件。 当我尝试在jqGrid中使用表单搜索时,在firebug中抛出了一个javascript异常。

未捕获的异常:语法错误,无法识别的表达式:[@ selected]

并且重置也无效 有人请帮帮我....

谢谢, 和Sandeep

编辑:


    jQuery("#list").jqGrid({
    url:'/getdata.jsp',
    datatype: 'xml',
    mtype: 'GET',
    colNames:['PSM ID','PSM Name','Responsibility','Date of Join(MM/dd/yyyy)','Date of Leaving(MM/dd/yyyy)','Designation','Organisation','Location','Phone Number','Email'],
    colModel :[ 
      {name:'PSM_EMP_ID',index:'PSM_EMP_ID',editable:false, width:75},
      {name:'PSM_EMP_Name',index:'PSM_EMP_Name',editable:true,width:100,editrules:{required:true,edithidden:false}}, 
      {name:'RESPONSIBILITY',index:'RESPONSIBILITY',editable:true,width:100}, 
      {name:'DATE_OF_JOIN',index:'DATE_OF_JOIN',width:90,editable:true,edittype:'text',editrules:{required:true},editoptions: {
          size: 10, maxlengh: 10,id:'datepicker1',dataInit: $(function(elem) {
          $("#datepicker1").datepicker({showOn: 'button',buttonImage:'/images/calendar.gif',
                buttonImageOnly: true});
          })
      }
      },
      {name:'DATE_OF_LEAVING', index:'DATE_OF_LEAVING', editable:true,width:110},
      {name:'DESIGNATION', index:'DESIGNATION',editable:true,editrules:{required:true},width:100},
      {name:'ORGANISATION', index:'ORGANISATION',editable:true,editrules:{required:true},width:180}, 
      {name:'LOCATION', index:'LOCATION', editable:true,editrules:{required:true},width:100}, 
      {name:'PSM_PHONE_NUMBER', index:'PSM_PHONE_NUMBER',editrules:{required:true},editable:true,width:100}, 
      {name:'PSM_EMAIL', index:'PSM_EMAIL', editable:true,editrules:{required:true},width:220}],
    pager: jQuery('#pager'),
    rowNum:10,
    rowList:[10,20,30],
    sortname: 'user',
    sortorder: "desc",
    viewrecords: false,
    multiselect:false,
    imgpath: '/themes/steel/images',
    caption: 'PSM',
    editurl: '/update.jsp', shrinkToFit: true
    /*width:1200 */}).navGrid('#pager',{add:true,addtext:'Add',edit:true,edittext:'Edit',del:true,deltext:'Del', search:true,searchtext:'Find'/*,refresh:true*/}, /*options*/
{height:300,width:500,reloadAfterSubmit:true}, /* edit options*/
{height:300,width:500,reloadAfterSubmit:true}, /* add options*/
{reloadAfterSubmit:true}, // del options
{} // search options
);

这是使用的代码......

1 个答案:

答案 0 :(得分:0)

您应该将以下属性添加到“DATE_OF_JOIN”列

searchoptions: {
    size: 10, maxlengh: 10,
    dataInit: function(elem) {
        setTimeout(function() {
            $(elem).datepicker({ showOn: 'button' });
        },100);
    }
}

并使用jqGrid 4.0,其中showOn: 'button'设置将在搜索对话框中有效。

如果你删除jqGrid的所有未知参数(比如非常旧的已弃用的imgpath参数)和具有默认值的参数(如multiselect:false等),这将是非常好的。

请参阅演示here