Hi Abu.
I changed a my grid from normal mode to excel view mode.
Now I have 2 problems.
Point one:
Previously I calculated the value of a column on basis of the value of the previous column.
If I use this slice code:
$col = array();
$col["title"] = $GLOBALS['language']['cost'];
$col["name"] = "Costo";
$col["width"] = "12";
$col["align"] = "right";
$col["hidden"] = (strpos($columns, ',' . $col["name"] . ',') > -1)?true:false;
$col["editable"] = true;
$col["editrules"] = array("custom"=>true, "custom_func"=>"function(val, label){return validaNumber(val, label);}");
$col["editoptions"] = array("size"=>$col["width"], "style"=>"text-align: right;");
$col["editoptions"]["onchange"] = "setPrezzoIntermedio(this)";
$col["formatter"] = "currency";
$col["formatoptions"] = array("prefix"=>"€ ",
"thousandsSeparator" => $GLOBALS['language']['thousandsSeparator'],
"decimalSeparator" => $GLOBALS['language']['decimalSeparator'],
"decimalPlaces" => 2);
$col["export"] = (strpos($columns, ',' . $col["name"] . ',') > -1)?false:true;
$cols[] = $col;
$col = array();
$col["title"] = $GLOBALS['language']['intermediate price'];
$col["name"] = "PrezzoIntermedio";
$col["width"] = "12";
$col["hidden"] = (strpos($columns, ',' . $col["name"] . ',') > -1)?true:false;
$col["align"] = "right";
$col["editable"] = true;
$col["editrules"] = array("custom"=>true, "custom_func"=>"function(val, label){return validaNumber(val, label);}");
$col["editoptions"] = array("size"=>$col["width"], "style"=>"text-align: right;");
$col["formatter"] = "currency";
$col["formatoptions"] = array("prefix"=>"€ ",
"thousandsSeparator" => $GLOBALS['language']['thousandsSeparator'],
"decimalSeparator" => $GLOBALS['language']['decimalSeparator'],
"decimalPlaces" => 2);
$col["export"] = (strpos($columns, ',' . $col["name"] . ',') > -1)?false:true;
$cols[] = $col;
…….
<script language="javascript" type="text/javascript">
var valuta = '€ ';
function setPrezzoIntermedio(o) {
var grid = $("#list1");
var selr = grid.jqGrid("getGridParam","selrow");
var v = o.value;
v = v.replace('.',',');
v = valuta + v;
$("#"+selr+" td[aria-describedby='list1_PrezzoIntermedio']").text(v);
$("#"+selr+" td[aria-describedby='list1_PrezzoIntermedio']").attr("title", v);
$("#"+selr+" td[aria-describedby='list1_PrezzoIntermedio']").removeClass("edit-cell ui-state-highlight");
$("#"+selr+" td[aria-describedby='list1_PrezzoIntermedio']").addClass("dirty-cell");
$("#"+selr+" td[aria-describedby='list1_PrezzoIntermedio']").attr("tabindex","-1");
}
</script>
It get that the next cell is updated but the entire grid is no longer active, as had lost the focus.
Point two:
If I must display an error, using pgpgrid_error, I obtain an server error and not my alert.
Suggestions.
Thanks in advance
Massimo Gagliardi
Hi Abu,
I don't know if is the best solution but I solved put a custom function, in witch I calculate the next cell and verify any error, in:
$col["editrules"] = array("custom"=>true, "custom_func"=>"function(val, label, x){return validaCellNumber(val, label, 3);}");
I'm waiting your remark.
thk
Yes, this should work fine.
For 500 error code message, currently alternate method is not supported.
Hi Abu,
I found a bug.
When the user put into a cell a numeric value with italian format using decimals with , separator the value disappears; this happens also if I correct the comma in point via custom_func.
How can I do?
Thanks in advance