Hi,
My code as below:
—-master section code—-
$grid["subgridparams"] = "id,date";
…
$col = array();
$col["title"] = "date";
$col["name"] = "date";
$col["editable"] = true;
$col["formatter"] = "date";
$col["editoptions"] = array("size"=>10, "defaultValue"=> date('Y-m-d'));
$cols[] = $col;
—-detail section code—-
$_SESSION['temp_date']=$_GET['date'];
…
$col = array();
$col["title"] = "date";
$col["name"] = "date";
$col["editable"] = true;
$col["formatter"] = "date";
$col["editoptions"] = array("defaultValue"=> $_SESSION["date"] );
$cols[] = $col;
————————–
In master section,I can set the default value to field "date",
but I cann't set the default value in detail , why?
Rgds,
In detail, you have to set default value using custom event (on_update / on_insert). This method will not work because setting of grid is made on start, and we generate detail grid on each master select.
Alternate way is to use custom events. Refer master-detail.php example. For detail grid …
$e["on_insert"] = array("add_client", null, true);
$grid->set_events($e);
function add_client(&$data)
{
$d = intval($_GET["date"]);
$data["params"]["date"] = $date;
}