PHPGRID-Master MultiDetails Help [Urgent]

QuestionsPHPGRID-Master MultiDetails Help [Urgent]
Rankaj asked 10 years ago

Hello to all,

Can any one help in rectifying the problem related to showing the 3 sub-grids based on master grid by passing different ids to each sub-grid.I have “Master Grid” showing data from multiple tables(store,space,street,brand,address etc) by joining in single view. Below master grid I have 3 sub grids(Space,Store,Address). I want to pass different ids from master grid onclick of row(master grid) to different subgrids functions like below:

1)space_id -> sub_grid_space()
2)store_ id -> sub_grid_store()
3)address_id -> sub_grid_address()

Queries:-
——–
1) Don’t load data into details sub-grid until row from master grid is clicked
2) I want to pass different ids (spaceid,storeid,addressid) for detail sub-grid accordingly from master grid

Reference Used:-
——————-
http://www.phpgrid.org/demo/demos/master-detail/master-multi-detail.php

Controller File Structure Below:-
——————————–>

public function __construct()
{
//Load PHPGRID Libraries
}

public function index()
{
//Master Grid
$grid["detail_grid_id"] = "sub_grid_space,sub_grid_store,sub_grid_address";
$grid["subgridparams"] = "space_id,store_id,address_id";
}
public function sub_grid_space() {
//Detail Subgrid1
$space_id =intval($_GET["space_id"]);
}

public function sub_grid_store() {
//Detail Subgrid2
$store_id =intval($_GET["store_id"]);
}

public function sub_grid_address() {
//Detail Subgrid3
$address_id =intval($_GET["address_id"]);
}

Model Files Structure:-
————————-

public function save_store_data($data){
}

public function save_space_data($data){
}

public function save_address_data($data){
}

Thanks & Regards
Rankaj

1 Answers
Abu Ghufran answered 10 years ago

Hi,

First, apologies for the delay. It was due to the research to stop load until master is clicked.

When you pass all the ids from master, like:

$grid["detail_grid_id"] = "sub_grid_space,sub_grid_store,sub_grid_address";
$grid["subgridparams"] = "space_id,store_id,address_id";

All the ids are passed to each detail grid. It's upto you to use it or not.

e.g.

public function sub_grid_space() {

//Detail Subgrid1

$space_id = $_GET["space_id"];

}

To stop loading detail grid, and load on master row select:

$opt["datatype"] = "local"; // stop loading detail grid at start

And edit lib/inc/jqgrid_dist.php, add datatype:'json'

if(ids == null)
{
ids=0;
if(jQuery('#".$detail_grid_id."').jqGrid('getGridParam','records') >0 )
{
jQuery('#".$detail_grid_id."').jqGrid('setGridParam',{datatype:'json',url:'".$detail_url."&rowid='+ids+data,editurl:'".$detail_url."&rowid='+ids+data,cellurl:'".$detail_url."&rowid='+ids+data,jqgrid_page:1});
jQuery('#".$detail_grid_id."').trigger('reloadGrid',[{jqgrid_page:1}]);
}
}
else
{
jQuery('#".$detail_grid_id."').jqGrid('setGridParam',{datatype:'json',url:'".$detail_url."&rowid='+ids+data,editurl:'".$detail_url."&rowid='+ids+data,cellurl:'".$detail_url."&rowid='+ids+data,jqgrid_page:1});
jQuery('#".$detail_grid_id."').trigger('reloadGrid',[{jqgrid_page:1}]);
}

Your Answer

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