jqGrid onSelectRow不工作

时间:2012-01-08 07:10:44

标签: javascript jqgrid

  

jqGrid中的onSelectRow事件不会在Chrome中触发我在鼠标悬停时遇到错误

Uncaught TypeError: Object #<Object> has no method 'closest'
b.fn.jqGrid.each.b.before.click.Yjquery.jqGrid.min.js:113
jQuery.event.handlejquery-1.2.6.min.js:26
jQuery.event.add.handle
  

当我点击该行时出现此错误

event.layerX and event.layerY are broken and deprecated in WebKit. They will be removed from the engine in the near future.
jquery.jqGrid.min.js:113Uncaught TypeError: Object #<Object> has no method 'closest'
b.fn.jqGrid.each.b.before.click.bind.a.p.datatypejquery.jqGrid.min.js:113
jQuery.event.handlejquery-1.2.6.min.js:26
jQuery.event.add.handlejquery-1.2.6.min.js:25
jquery.jqGrid.min.js:113Uncaught TypeError: Object #<Object> has no method 'closest'
b.fn.jqGrid.each.b.before.click.Yjquery.jqGrid.min.js:113
jQuery.event.handlejquery-1.2.6.min.js:26
jQuery.event.add.handle
  

任何帮助?请问这是我的代码

$('#PrimaryGrid').jqGrid({
                datastr: GetJSON(),
                datatype : 'jsonstring',  
                width:676,
                colNames: ['Code', 'Description', 'Qty', 'Price','Total',''],
      colModel:
      [
           { name: 'Code', index: 'Code', width: 50, align: 'left', sortable: false  },
           { name: 'Description', index: 'Description', width: 305, align: 'left', sortable: false  },
           { name: 'Qty', index: 'Qty', width: 50, align: 'center', sortable: false },
           { name: 'Price', index: 'Price', width: 100, align: 'right', sortable: false },
                         { name: 'Total', index: 'Total', width: 100, align: 'right', sortable: false },
                         {name:'subg',index:'subg', width:1,sortable:false},
      ],
      rowNum: -1,
      height: 'auto',
          multiselect: false,
      sortname: 'Qty',
      sortorder: 'ASC',
                subGrid: true,
                loadonce: false,
                gridComplete: function () { 
                    var ids = $("#PrimaryGrid").getDataIDs(); 
                    for (var i = 0; i < ids.length; i++) {
                        if($("#PrimaryGrid").getRowData(i).subg == "false"){
                            $('tr#'+i, $("#PrimaryGrid"))
                            .children("td.sgcollapsed")
                            .html("")
                            .removeClass('ui-sgcollapsed sgcollapsed');
                        }
                    }
                },
                onSelectRow: function(id){ 
                    alert('Selected row ID ' + id);
                },
                caption: '<div style="width:630px;height:20px;">Items and Bills</div>'
            });

1 个答案:

答案 0 :(得分:-1)

我使用jqGrid和jQuery 1.6.1多次得到同样的错误,我升级到jQuery 1.7.1并且停止了这个错误。尝试下载并使用最新版本的jQuery。