Pregunta

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?

¿Fue útil?

Solución

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));
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top