dtjkl42086 2014-01-31 08:58
浏览 54
已采纳

在JqGrid for PHP中的行编辑时自动增加字段?

In JqSuite for PHP, I am trying to auto-increment a field value everytime I submit a row edit. My code is not working though!

grid.php excerpt:

$custom = <<<CUSTOM

var rowId;
var keys, oneditfunc, succesfunc, url, extraparam, errorfunc, afterrestorefunc;

function aftersavefunc(rowId, response) {
    alert("aftersavefunc Fired!");
    alert(rowId);

    $("#grid").jqGrid('setCell', rowId, 'revision', '3');
}

jQuery("#grid").jqGrid('editRow', rowId, keys, oneditfunc, 
        succesfunc, url, extraparam, aftersavefunc, errorfunc, afterrestorefunc);

CUSTOM;

I don't even get the alert popup from alert("aftersavefunc Fired!");

Is anybody able to do this?

  • 写回答

1条回答 默认 最新

  • duan6161 2014-02-03 11:55
    关注

    I found a solution to my question: I just needed to use:

    $cid = jqGridUtils::GetParam('my_id');
    
    $grid->setAfterCrudAction('edit', "UPDATE my_table SET revision  = revision + 1 WHERE my_id=?",array($cid));
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型
  • ¥50 buildozer打包kivy app失败
  • ¥30 在vs2022里运行python代码
  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
  • ¥15 求解 yolo算法问题
  • ¥15 虚拟机打包apk出现错误
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 三菱伺服电机按启动按钮有使能但不动作