gpt4 book ai didi

php - 如何在 jqgrid PHP 中进行计算

转载 作者:行者123 更新时间:2023-11-30 00:07:57 26 4
gpt4 key购买 nike

我有一个问题

我在jqGrid中有3列.

假设为ABC

当我插入数据时,我只需填写A列和B列的数据。

C 会自动插入 A+B 的值。

我正在使用 PHP 的 jqGrid,并使用表单插入数据

有没有办法如何分配和插入C的值?

最佳答案

您可以使用 custom formatter 计算 C 的值没有 PHP

<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;
}}
]
})

关于php - 如何在 jqgrid PHP 中进行计算,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24357708/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com