【问题标题】:getting the contents of a cell from Jqgrid从 Jqgrid 获取单元格的内容
【发布时间】:2012-02-04 10:45:39
【问题描述】:

我正在尝试从 jQgrid 获取单元格的值以用于 javascript。

我试过了

$('#grid').click(function(rowid,iCol,cellcontent,e,id) {
  var rowData = $(this).getRowData(id); 
  var temp= rowData['ecu'];
  var existingtext = $("#debug").html()+'<br />';
$("#debug").html(existingtext +" "+cellcontent+" "+e+" "+iCol+" "+rowid+" "+temp);

但我不断得到 undefined 和 [object, object]

【问题讨论】:

    标签: jquery jqgrid


    【解决方案1】:

    您的主要错误是您使用了jQuery.click 而不是像onCellSelect 这样的jqGrid 回调。如果您定义 jqGrid,您可以在其选项列表中包含任何来自支持的回调函数,例如 onCellSelect:

    $('#grid').jqGrid({
        // any other options which you need
        onCellSelect: function (rowid, iCol, cellcontent) {
            $('#debug').append('<br />cellcontent=' + cellcontent +
                ', rowid=' + rowid + ', iCol=' + iCol +
                ', ecu=' + $(this).jqGrid('getCell', rowid, 'ecu'));
        }
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-06-04
      • 2011-03-28
      • 1970-01-01
      • 1970-01-01
      • 2011-05-27
      • 2011-03-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多