Hi Abu,
I need a litle push!
The case is
$col = array();
$col[“title”] = “Cant.<br>hay”;
$col[“name”] = “cantidadhay”;
$col[“width”] = “6”;
$col[“align”] = “right”;
$col[“formatter”] = “number”;
$col[“formatoptions”] = array(“prefix” => ”,”suffix” => ”,”thousandsSeparator” => ‘.’,”decimalSeparator” => ‘,’,”decimalPlaces” => 0);
$col[“editable”] = true;
$col[“editrules”][“readonly”] = true;
$cols[] = $col;
and when press save
The message is “Couldn’t execute query. Unknown column ‘cantidadhay’ in ‘field list’ – UPDATE guiadespachoventadetalletmp SET `cantidadhay`=’3′,`cantidad`=’3′ WHERE n_item IN (‘5’)”
I don´t want to update ‘cantidadhay’ only I want to read it.The `cantidad`=’3′ is Ok update.
I would appreciate your help
Hello,
You can have an on_update event handler and remove it from query after postback. e.g.
$e["on_update"] = array("update_data", null, true); $g->set_events($e); function update_data($data) { unset($data["cantidadhay"]); }
Hi Abu,
Thank you
But I have to add I use the method
$grid = new jqgrid($db_conf);
$opt[“caption”] = “Detalle Orden de Compra”;
$opt[“sortname”] = ‘descripcion’;
$opt[“sortorder”] = “asc”;
$opt[“width”] = “667”;
$opt[“height”] = “185”;
$opt[“edit_options”][“beforeSubmit”] = “function(post,form){ return validate_form_once(post,form); }”;
$opt[“edit_options”][“afterSubmit”] = “function(){ sumacompragrilla();return [true,”];}”;
$opt[“edit_options”][“reloadAfterSubmit”]=false;
and below in javascrit
function validate_form_once(post,form)
{
var str=[];
if (parseFloat(post.stock_minimo) <= 0)
str[str.length] = “Stock mínimo debe ser mayor a 0”;
else
if (parseFloat(post.stock_minimo) > parseFloat(post.stock_maximo))
str[str.length] = “Stock mínimo debe ser menor a ” + post.stock_maximo + ” ,stock máximo.”;
else
if (parseFloat(post.reposicion) > parseFloat(post.stock_maximo))
str[str.length] = “Reposición debe ser menor a ” + post.stock_maximo + ” ,stock máximo.”;
else
if (parseFloat(post.stock_minimo) > parseFloat(post.reposicion))
str[str.length] = “Stock mínimo debe ser menor a ” + post.reposicion + ” ,Reposición.”;
else
if (parseFloat(post.cantidad) > parseFloat(post.cantidad_sucursal))
str[str.length] = “Cantidad debe ser menor o igual a ” + post.cantidad_sucursal + ” ,Sucursal origen.”;
else
if (parseFloat(post.cantidad) < 0)
str[str.length] = “La compra debe ser mayor a 0”;
else
if (parseFloat(post.cantidad) <= parseFloat(post.hay))// I DON’T WANT TO UPDATE THIS FIELD post.hay
str[str.length] = “Cantidad debe ser menor o igual a ” + post.hay + ” ,Stock.”;
str = str.join(“<br>”);
if (str.length == 0)
return [true,””];
else
return [false,”Revise el siguiente problema:<br>” + str];
}
I appreciate your help