Add new row in subgrid : master rowid missing

QuestionsAdd new row in subgrid : master rowid missing
biowan asked 8 years ago

Hi,

I created a master grid order and article as detail grid. I can update and delete article items. But I'm not abled to add a new article. Because order id isn't put in the article add form. I read the demo sample "Master detail" code, but I don't understand where I can put the order.id in article.order_id.

Thanks for your help.

4 Answers
Abu Ghufran answered 8 years ago

You can use on_insert event and update $_GET["rowid"] which is master grid PK.
e.g.

$e["on_insert"] = array("add_client", null, true);
$grid->set_events($e);

function add_client(&$data)
{
$id = intval($_GET["rowid"]);
$data["params"]["client_id"] = $id;
}

Refer demos/master-detail/master-detail.php

biowan answered 8 years ago

Is there a solution with javascript integration ?
I tried to integrate the on_insert function in my own framework, no way :'(

biowan answered 8 years ago

Ok, it's working with my framework (object). But it's not really good to do it in my way. I added the on insert function in global area outside the object. :'(

Abu Ghufran answered 8 years ago

You can have on_insert inside the class and set event handler like:

$e["on_insert"] = array("function-name", "class-name", true);

Your Answer

5 + 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?