How to get a jqGrid cell value when editing

前端 未结 23 2644
日久生厌
日久生厌 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:21

    Here is an example of basic solution with a user function.

        ondblClickRow: function(rowid) {
            var cont = $('#grid').getCell(rowid, 'MyCol');
            var val = getCellValue(cont);
        }
    

    ...

    function getCellValue(content) {
        var k1 = content.indexOf(' value=', 0);
        var k2 = content.indexOf(' name=', k1);
        var val = '';
        if (k1 > 0) {
            val = content.substr(k1 + 7, k2 - k1 - 6);
        }
        return val;
    }
    

提交回复
热议问题