[英]how to do calculation in jqgrid PHP
I have a problem 我有个问题
I have 3 column in jqGrid
. 我在jqGrid
有3列。
Let's say it A
, B
, C
. 假设它是A
, B
, C
。
When I insert data, I only have to fill data for column A
and B
. 插入数据时,我只需要填充列A
和B
。
Column C
is automatically inserted with the value of A
+ B
. C
列将自动插入A
+ B
的值。
I'm using jqGrid for PHP and I'm using form to insert the data 我正在使用jqGrid for PHP,并且正在使用表单插入数据
Is there a way on how to assign and insert the value of C
? 有没有办法分配和插入C
的值?
You can calculate the value of C with a custom formatter without PHP 您可以使用不使用PHP的自定义格式器来计算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;
}}
]
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.