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
You can call click() of first group on load event of datagrid.
$opt[“loadComplete”] = “function(){ jQuery(‘.jqgroup:first span’).click(); }”;
// …
$g->set_options($opt);
Hello,
Copied/Pasted your exact code. No action unfortunately.
Regards,
Jean-Luc
Screenshot:
Code: https://gist.github.com/gridphp/75ce246651e9daf00c91234e336ebedc Line 49,52
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
I’ll be updating back after some more testing.
For parent grid see index.php + line 49,52
For subgrid see index_detail.php + line 53
Code: https://gist.github.com/gridphp/75ce246651e9daf00c91234e336ebedc
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
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