Master/detail conditional

QuestionsMaster/detail conditional
Gustavo Lazaro asked 2 months ago

Dear Abu. I have two master / detail grids. Grid 1 (master) has a field with values ​​yes or no. I send this field as a parameter for the detail grid next to the ID. The detail grid table has the following fields: field1, field2, field3, field4, field5 and field6. If the master sends “YES”, I must display the following fields: field1, field2, field3, field4. But if you send “NO” it should show the fields: field1, field2, field5, field6. Is there any possibility that this can be done?

1 Answers
Abu Ghufran Staff answered 1 month ago

Currently it is not doable with master-detail grid. If you are using master-subgrid (nested grid) then it is doable.

Reason, in master-detail, both datagrids are loaded and structure is created. It only fetches data via ajax. Structure (fields) are not re-created on reload. Where as in subgrid, each time you press + on master row, complete grid is created again.

One option is to hide / show certain columns on loadComplete event.

if ( <yes is posted> ) {
    $opt["loadComplete"] = "function(){ 
        $('#list1').jqGrid('hideCol', 'somecol1');
        $('#list1').jqGrid('showCol', 'somecol2');

else {
    $opt["loadComplete"] = "function(){ 
        $('#list1').jqGrid('hideCol', 'somecol2');
        $('#list1').jqGrid('showCol', 'somecol1');

Abu Ghufran - Dev Team
Grid 4 PHP Framework
Your Answer

4 + 18 =

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?