jqGrid: searchoptions中的dataUrl不能与jqGrid4.4.5一起工作



我有点被jqgrid中的searchoptions属性卡住了。当我点击网格中的搜索图标并通过"下拉"遍历字段时,我在firefox和IE8中看到了以下错误

FF: TypeError: g is undefined in jquery.jqGrid.min.js (line 239)

IE: Message: 'postData' is null or not an object Line: 238

下面是代码片段
  {name:'City', index:'City', width:80, align:'right', 
   editable: true,search:true,edittype: 'select',stype:'select',
   searchoptions: {
     ajaxSelectOptions: {type: "GET",datatype:"text"},
     dataUrl:  '/TESTAPP/Test',          
     dataEvents: [
             {  type: 'change',
                fn: function(e) {
                  alert(this.value)
              }
             } 
          ]}

我甚至没有看到请求到达服务器,这很奇怪。

p。S:同样适用于editoptions

版本:

jqGrid: 4.4.5

jquery: 1.9.1

谢谢你的帮助!

ajaxselectopoptions 应该包含jqGrid用于单个搜索和高级搜索,以便为colModel中的任何列启用'select'选项。

 var grid = $("#list");
 grid.jqGrid({
     ajaxSelectOptions: {type: "GET"},
     colModel: [ 
            {name:'City', index:'City', width:80, align:'right', 
             editable:  true,
             search:true, 
             edittype: 'select',
             stype:'select',
             searchoptions: {
                 dataUrl: '/TESTAPP/Test',
                 buildSelect: function(resp) {
                     var sel= '<select>';
                     var obj = $.parseJSON(resp);
                     $.each(obj, function() {
                         sel += '<option value="'+this['value']+ '">'+this['label'] + "</option>"; // label and value are returned from Java layer
                     });
                     sel += '</select>';
                     return sel;
                 },          
                 dataEvents: [{  
                     type: 'change',
                     fn: function(e) {
                         alert(this.value)
                     }
                 }]
             }
      }]
 });

我在Chrome中有同样的问题。我得到以下错误

Uncaught TypeError: Cannot read property 'postData' of undefined jquery.jqGrid.min.js:239
添加

ajaxSelectOptions: {type: "GET"} 

固定它。由于

最新更新