the detail grid cann't get the default value

Questionsthe detail grid cann't get the default value
Chao Shun Jenq asked 11 years ago

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,

1 Answers
Abu Ghufran answered 11 years ago

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;
}

Your Answer

9 + 8 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?