【发布时间】:2014-06-23 02:30:43
【问题描述】:
我有问题
我在jqGrid 中有 3 列。
我们说A,B,C。
当我插入数据时,我只需要填写A和B列的数据。
C 列自动插入A+B 的值。
我正在使用 jqGrid for PHP,我正在使用表单插入数据
有没有办法分配和插入C 的值?
【问题讨论】:
-
您尝试执行此操作的代码在哪里?
我有问题
我在jqGrid 中有 3 列。
我们说A,B,C。
当我插入数据时,我只需要填写A和B列的数据。
C 列自动插入A+B 的值。
我正在使用 jqGrid for PHP,我正在使用表单插入数据
有没有办法分配和插入C 的值?
【问题讨论】:
不用 PHP 也可以用 custom formatter 计算 C 的值
<table id="#grid-table"></table>
jQuery("#grid-table").jqGrid({
colNames: ['id', 'A', 'B', 'C'],
colModel: [
{name: 'id', key: true, index: 'id', hidden: true},
{name: 'A', index: 'A'},
{name: 'B', index: 'B'},
{name: 'C', formatter: function(cellvalue, options, rowData) {
return rowData.A + rowData.B;
}}
]
})
【讨论】: