Is it possible to not allow to input value in a particular column if the value of another column contain word "YES" or "UNCERTAIN" in edit mode?
You can connect onblur event and in callback function set particular textbox as readonly or editable.
$col["editoptions"] = array("onblur" => "update_field(this)");
<script>
function update_field(o)
{
if ($(o).val() == "YES" || $(o).val() == "UNCERTAIN")
$("#particular_column").attr("disabled","disabled");
else
$("#particular_column").attr("disabled",false);
}
</script>
For inline editing, you will also need to set like:
$("input[name='particular_column'].editable").attr("disabled",false);
You can inspect the field id.using firebug and use jquery functions to disable / enable desired field.
To know jquery selector:
http://easycaptures.com/fs/uploaded/1017/9892108434.png
http://easycaptures.com/fs/uploaded/1017/9617668813.png
It don't work. pls see my code as below
$col = array();
$col["title"] = "回來時間";
$col["name"] = "in_time";
$col["width"] = "50";
$col["editable"] = true; // this column is editable
$col["editoptions"] = array("size"=>20); // with default display of textbox with size 20
//$col["editrules"] = array("required"=>FALSE); // required:true(false), number:true(false), minValue:val, maxValue:val
$col["editrules"] = array("custom"=>true,"custom_func"=>"function(value, label){return my_validation(value, label);}");
$col["formatter"] = "datetime"; // format as date
$col["formatoptions"] = array("srcformat"=>'H:i:s',"newformat"=>'H:i:s',"opts" => array("timeOnly" => true));
$col["search"] = true;
$cols[] = $col;
$col = array();
$col["title"] = "å³æ—¥è¿”回公å¸";
$col["name"] = "back_to_office";
$col["width"] = "50";
$col["search"] = true;
$col["editable"] = true; // this column is not editable
$col["edittype"] = "select";
$col["editoptions"] = array("value"=>'Yes:Yes;No:No;Uncertain:Uncertain', "multiple" => true, "onblur" => "update_field(this)");
$col["align"] = "left"; // this column is not editable
$cols[] = $col;
<script>
function update_field(o)
{
if ($(o).val() == "No" || $(o).val() == "Uncertain")
//$("#in_time").attr("disabled","disabled");
$("input[name='in_time'].editable").attr("disabled",false);
else
$("#in_time").attr("disabled",false);
}
</script>