How to get a jqGrid cell value when editing

前端 未结 23 2650
日久生厌
日久生厌 2020-11-27 17:43

How to get a jqGrid cell value when in-line editing (getcell and getRowData returns the cell content and not the actuall value of the input element).

23条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-27 18:18

    I've got a rather indirect way. Your data should have an unique id.

    First, setting a formatter

    $.extend(true, $.fn.fmatter, {          
    numdata: function(cellvalue, options, rowdata){
        return ''+rowdata.num+'';
    }
    });
    

    Use this formatter in ColModel. To retrieve ID (e.g. selected row)

    var grid = $("#grid"), 
        rowId = grid.getGridPara('selrow'),
        num = grid.find("#"+rowId+" span.numData").attr("data-num");
    

    (or you can directly use .data() for latest jquery 1.4.4)

提交回复
热议问题