Master Multi Details

QuestionsMaster Multi Details
Gary Brett asked 10 years ago

Hi there, is it possible to have 3 grids as per your demo looking at 3 different tables? I have clients, notes & tasks tables are with client_id field.

I can set the master & notes or master & tasks but cant seem to have all 3 on one page. The last table, tasks does not reference the client_id from the master?

Sample code is http://pastebin.com/fbFjxL9c if it helps at all?

7 Answers
Abu Ghufran answered 10 years ago

To connect master with 2 grids, set:

$opt["detail_grid_id"] = "list2,list3";

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

Gary Brett answered 10 years ago

Hi Abu, thank you I have already added that to code but no joy. If I change the query to an actual value it does display that data but on changing back to parent id it doesn't pull through in list3..

WHERE client_id = $id"; works in list2 but not list3, changing to WHERE client_id = 5"; for example outputs client_id 5 from tbl_tasks?

I also note on the demo that we cant change columns [hide, title etc] as I I set $grid->set_columns($cols); on list 3 it includes list 2 columns in list 3 grid?

Any ideas?

Cheers

Abu Ghufran answered 10 years ago

Reset all variables before using in other grid.

For e.g. if var $cols is used in first grid, then null it before using in next.
$cols = array();

Same applies to all others which are reused.

Gary Brett answered 10 years ago

Hi Abu, I have list 2 & 3 working now but still am unable to set columns on grid 3, for example a date column or hiding columns when adding?

I notice on your master-multi-detail demo that the data column in list 3 is formatted as a date however setting the client_id column as hidden doesn't hide it?

$col = array();
$col["title"] = "Client Id";
$col["name"] = "client_id";
$col["width"] = "10";
$col["editable"] = true;
$col["hidden"] = true;
$cols[] = $col;

In list 2 you have $grid->set_columns($cols); but I cant add that to list 3 to achieve the above?

Thank you

Gary

Gary Brett answered 10 years ago

Sorry full code is here http://pastebin.com/RfdBT9ur

Abu Ghufran answered 10 years ago

Refer this: http://pastebin.com/5rXHLie0

My suggestion is, when ever you use $cols and set_columns($cols) … reset them. e.g.

$cols = array();

$grid->set_columns($cols);

Gary Brett answered 10 years ago

Excellent, I missed the $cols=array(). Many thanks once more

Your Answer

13 + 16 =

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?