我正在使用带有jqGrid的inlineEdit Row。我正在开发我的演示链接。 http://jsfiddle.net/yzu1prw1/1/
我想更新金额或税额的更改。我不确定,怎么做。
$jsonArray = json_decode($json, true);
$data = $jsonArray['response']['data'];
$countryCodes = [];
foreach ($data as $datum) {
if (isset($datum['countries'])) {
foreach ($datum['countries'] as $key => $value) {
$countryCodes[$key] = $value['code']; // $key is also code
// so maybe $countryCodes[$key] = $value['name'];
}
}
}
print_r($countryCodes); // array of codes
答案 0 :(得分:0)
修改后的演示https://jsfiddle.net/OlegKi/hrzf03xh/2/使用aftersavefunc
aftersavefunc: function (rowid) {
var $self = $(this),
item = $self.jqGrid("getLocalRow", rowid),
total = (parseFloat(item.amount) + parseFloat(item.tax)).toFixed(2);
$self.jqGrid("setCell", rowid, "total", total);
$self.focus();
}
我用于演示free jqGrid,我开发的分支,我建议你使用它,但一般来说同样的技巧将适用于旧版本的jqGrid。您应该谨慎使用getLocalRow
,这是编辑本地数据(datatype: "local"
)时的最佳选择,但在使用情况下应更换为getRowData
{ {1}}或datatype: "json"
。