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.
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"];
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.
I have another question about master-detail subgrid. Is possible to resize subgrid width to for expample 70%?.
thanks again.
In subgrid_detail.php, you can set width like:
<div style="padding:5px;width:70%">
<?php echo $out; ?>
</div>
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.
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>
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.