Collapse All but one Group

QuestionsCollapse All but one Group
Jean-Luc Marmier asked 5 years ago

Hello,

With column groups, it is possible to have them collapse or not at load time:

$opt[“groupingView”][“groupCollapse”] = true/false;

Is there a way to have all groups collapsed except one (first one) ?

Thanks in advance.
Best Regards,

Jean-Luc

 

8 Answers
Abu Ghufran Staff answered 5 years ago

You can call click() of first group on load event of datagrid.

$opt[“loadComplete”] = “function(){ jQuery(‘.jqgroup:first span’).click(); }”;
// …
$g->set_options($opt);

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Jean-Luc Marmier answered 5 years ago

Hello,

Copied/Pasted your exact code. No action unfortunately.

Regards,

Jean-Luc

Abu Ghufran Staff answered 5 years ago
_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Jean-Luc Marmier answered 5 years ago

Hello Abu,

Having investigated further our issue, I found the following.

If my ‘grouped grid’ is the main grid, it works fine as expected.

If the ‘grouped grid’ is a sub-grid, then it does not. That’s our configuration:

Grid1 -> Sub-Grid2 (grouped)

Any idea ?

 

Best Regards

Jean-Luc

Abu Ghufran Staff answered 5 years ago

I’ll be updating back after some more testing.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Abu Ghufran Staff answered 5 years ago

For parent grid see index.php + line 49,52

For subgrid see index_detail.php + line 53

Code: https://gist.github.com/gridphp/75ce246651e9daf00c91234e336ebedc

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Jean-Luc Marmier answered 5 years ago

Hello Abu,

Result is a bit better but not 100%:

The issue is that I have several sub-grids (different tabs) under the main one.

Main Grid -> Tab1 Sub-Grid1
Tab2 Sub-Grid2
Tab3 Sub-Grid3

The mentioned code :

$opt[“loadComplete”] = “function(){ jQuery(‘.subgrid-data .jqgroup:first span’).click(); }”;

Even if attached to sub-grid3  acts on sub-grid1 systematically.

Therefore is there a way to ‘name’ the right sub-grid jQuery should act on ?

 

Kind Regards,

Jean-Luc

Abu Ghufran Staff answered 5 years ago

Hi again,

Replace subgrid loadComplete with following. Replace bold with subgrid id.

$opt[“loadComplete”] = “function(o){ jQuery(‘[id$=list_detail]’).closest(‘.subgrid-data’).find(‘.jqgroup:first span’).click(); }”;

https://gist.github.com/gridphp/75ce246651e9daf00c91234e336ebedc#file-index_detail-php-L53

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

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