Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JQGrid setCell自定义格式化程序_Jqgrid - Fatal编程技术网

JQGrid setCell自定义格式化程序

JQGrid setCell自定义格式化程序,jqgrid,Jqgrid,我正在使用setCell设置单元格的值。问题是它仍在调用为列指定的customFormatter。我是否可以设置此单元格的值,而不必通过customFormatter?首先,每次网格刷新都会使用这些值,因此要设置单元格值,必须在自定义格式化程序之后执行此操作。执行此操作的最佳位置是在或事件处理程序内部 例如,要设置单元格值,可以使用jQuery.text。因此,您应该获取表示单元格元素的jQuery对象,然后使用jQuery.text或jQuery.html来更改单元格包含的内容。我是如何理解您

我正在使用setCell设置单元格的值。问题是它仍在调用为列指定的customFormatter。我是否可以设置此单元格的值,而不必通过customFormatter?

首先,每次网格刷新都会使用这些值,因此要设置单元格值,必须在自定义格式化程序之后执行此操作。执行此操作的最佳位置是在或事件处理程序内部

例如,要设置单元格值,可以使用jQuery.text。因此,您应该获取表示单元格元素的jQuery对象,然后使用jQuery.text或jQuery.html来更改单元格包含的内容。我是如何理解您的,您知道单元格的rowid和要更改的列名。以下代码可能是:

loadComplete: function() {
    var rowid = '2', colName = 'ship_via', tr,
        cm = this.p.colModel, iCol = 0, cCol = cm.length;
    for (; iCol<cCol; iCol++) {
        if (cm[iCol].name === colName) {
            // the column found
            tr = this.rows.namedItem(rowid);
            if (tr) {
                // if the row with the rowid there are on the page
                $(tr.cells[iCol]).text('Bla Bla');
            }
            break;
        }
    }
}
请参阅相应的演示。