Hi,
I have 3 cols in my grid.
col1 and col2 visible and not editable.
col3 is editable.
When data is saved, i want to validate whether col3 value greater than col2 and col1.
there is no value returned in variable r.
can you please help.
Hello,
1,2) For multi-inline edit, you can have grid like http://www.phpgrid.org/updates/open-grid-in-edit-mode-by-default/
3) This is doable via server side validation. For e.g.
$e["on_update"] = array("edit_client", null, false);
$grid->set_events($e);
function edit_client($data)
{
if ($data["params"]["col3"] + $data["params"]["col4"] > $data["params"]["col5"])
phpgrid_error("Invalid entry, My custom error message");
}
Refer demos/editing/server-validation.php for code example.
In addition to above, To make column available on server side callback, it must be editable.
if you want few columns to be non-editable, you can have actual columns are editable – hidden, and 2 virtual columns that are non-editable & visible.
$col = array();
$col["title"] = "Col2";
$col["name"] = "col2";
$col["width"] = "200";
$col["editable"] = true;
$col["hidden"] = true;
$cols[] = $col;
// virtual column
$col = array();
$col["title"] = "Col2";
$col["name"] = "col2-virtual";
$col["width"] = "200";
$col["editable"] = false;
$col["hidden"] = false;
$col["default"] = "{col2}";
$cols[] = $col;
I want to compare two data fields.
If “cost” > “pay” and “pay” != 0 then show message “the value is more then “+”pay” and I want to data field = 0.
How can I?
$col = array();
$col["title"] = "cost";
$col["name"] = "cost";
$col["width"] = "10";
$col["align"] = "right"; // this column is not editable
$col["search"] = false; // this column is not searchable
$cols[] = $col;
$col = array();
$col["title"] = "pay";
$col["name"] = "pay";
$col["width"] = "10";
$col["align"] = "right"; // this column is not editable
$col["search"] = false; // this column is not searchable
$col["editable"] = true;
$cols[] = $col;
# Customization of Action column width and other properties
$col = array();
$col["title"] = "Accion";
$col["name"] = "act";
$col["width"] = "20";
$cols[] = $col;
Thank you again