문제

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?

도움이 되었습니까?

해결책

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));
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top