Abu this is my code:
function update_data($data)
{
//phpgrid_error($data);
// you can also use grid object to execute sql, useful in non-mysql driver
// global $grid;
// $grid->execute_query("MY-SQL");
date_default_timezone_set('America/Bogota');
$date1 = date("Y-m-d H:i:s"); // This is Llegada Col
$date2 = $data["params"]["note"]; //This is Salida Col
// phpgrid_error($data);
//Convert them to timestamps.
$date1Timestamp = strtotime($date1);
$date2Timestamp = strtotime($date2);
//Calculate the difference.
$difference = ($date1Timestamp – $date2Timestamp)/60;
$diferencia= number_format($difference, 0, '.', ',');
$data["params"]["staff_note"] = $date1;
$data["params"]["due_date"] = $diferencia;
$data["params"]["shipping"] = $data["params"]["shipping"];
$data["params"]["total"] = $data["params"]["total"];
/*
if
(($data["params"]["due_date"]) >= ($data["params"]["reference_no"])){
$data["params"]["updated_by"] = (($data["params"]["due_date"]) – ($data["params"]["reference_no"]));
}
else
{
$data["params"]["updated_by"] = 0;
}
endif;
*/
//Recobro = excedió x 500
$data["params"]["attachment"] = $data["params"]["attachment"];
$data["params"]["paid"] = $data["params"]["total"];
$data["params"]["updated_at"] = $data["params"]["updated_by"] * (500);
//subtotal = Recobro
//$data["params"]["total_discount"] = $data["params"]["updated_at"];
//total = precio – descuento
//total = total + subtotal
//$data["params"]["total"] = $data["params"]["total"] + $data["params"]["total_discount"]
$data["params"]["grand_total"] = $data["params"]["updated_at"];
$data["params"]["total"] = $data["params"]["grand_total"] + $data["params"]["paid"];
$data["params"]["sale_status"] = "Completed";
$data["params"]["total_tax"] = 0;
}
This is executing on_update method, so I need be working on_after_insert but using setTimeOut to update each minute for example.
Thank you!
Are you implementing something like Autosave function?
Please tell exact scenario so i can suggest better.
Screenshot would help.
Currently this is not supported by grid.
If you know the row id, you can set it using
var grid = $("#list1");
grid.jqGrid('setCell',id,'price','2000');
where list1 is gridid, price is column name, 2000 is value to set in cell.
I think i still don't understand your question. Please explain more if not resolved.