Master-Detail Grid: The ID of the grid parent is not passed to the detail grid.

QuestionsMaster-Detail Grid: The ID of the grid parent is not passed to the detail grid.
Montemaggiore Sebastian asked 4 years ago

Hello Abu. I appeal for your help again. I am trying to use a master detail grid and the problem i have is that the id of the grid parent is not passed to the detail grid. I called this id "p_id". I put my code in pastebin:
– Master grid: http://pastebin.com/2hQPyYxN
– Detail grid: http://pastebin.com/KZw3yZ9M
I use the master-detail grid to keep update three tables in my database. Two of them are entities an the last is a relation between the first two.
I follow the example: subgrid.php and subgrid_detail.php, and i don´t see where is my mistake. Can you take a look to my code?. The interesting part of my code is that i´m using the master-detail grid to implement the relation between two entities and the examples you give use only a strong entitie and a soft entitie. if I resolve this would be great because is very normal that one has to implement relatiosn likes these. Thanks.

9 Answers
Abu Ghufran answered 4 years ago

Your code looks fine. Try debugging using firebug and see the details of ajax call when you select a row of master grid.
This ajax call actually loads details and pass the params to detail.

Also try replacing:
$p_id = $_REQUEST["rowid"];

with:
$p_id = $_REQUEST["p_id"];

Montemaggiore Sebastian answered 4 years ago

Hello Abu. I could find the error using Firebug as you suggested. The problemas was that in the function the global variable "$p_id" was not visible because all variables in a php function have local scope.
I correct the Pastebin:
– Detail grid: http://pastebin.com/KZw3yZ9M
Thanks for your help again.

Abu Ghufran answered 4 years ago

Inside function, inside of global $p_id, use:
$p_id = $_REQUEST["rowid"];

Montemaggiore Sebastian answered 4 years ago

I have another question about master-detail subgrid. Is possible to resize subgrid width to for expample 70%?.
thanks again.

Abu Ghufran answered 4 years ago

In subgrid_detail.php, you can set width like:

<div style="padding:5px;width:70%">
<?php echo $out; ?>
</div>

Montemaggiore Sebastian answered 4 years ago

Hello Abu. I implement your suggestion but unfortunatly it doesn`t work. The subgrid only respond to two events:
– $grid["autoresize"] = true; // 100 %
– $grid["autoresize"] = false; // exact
Do you know another way?.
Thanks for you help an patient.

Abu Ghufran answered 4 years ago

Set,

$grid["autoresize"] = false;
$grid["autowidth"] = true;

Remove, if any
$grid["width"] = 'xxx';

And where you echo $out, set the width of container div.
We make grid to be full width, and limiting the width of container.

<div style="padding:5px;width:70%">
<?php echo $out; ?>
</div>

Montemaggiore Sebastian answered 4 years ago

Hello Abu. It works but not as i was expected. when you resize the browser the grid does not take the width it should have , for example 70 %. Do you know why?.
Thanks again.

Abu Ghufran answered 4 years ago

Hello,

I tested this scemario but currently subgrid auto resize is not fully supported.
I've emailed you updated build, that resizes the grid but not column headers which is incomplete way.

Your Answer

2 + 19 =

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 / 5. Vote count:

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

Let us improve this post!