Jump to content

How to FullCollaps / FullExpand grouped TUniDBGrid ?


Freeman35

Recommended Posts

On 11/5/2018 at 6:42 PM, Freeman35 said:

I wanna after open dataset, Collaps all group

Hello,

One of the possible solution I think

1. CustomCSS:

.x-grid-group-hd-collapsed .x-grid-group-title {
    background-image: none;
}

2. UniDBGrid1 -> OnAfterLoad event:

procedure TMainForm.UniDBGrid1AfterLoad(Sender: TUniDBGrid);
begin
  UniDBGrid1.JSInterface.JSCall('view.features[0].collapseAll', []);
end;

 

Link to comment
Share on other sites

  • 4 years later...
1 hour ago, fraxzi said:

i just want to expand the first group by code.

Okay, you can try to use this approach:

1. UniDBGrid1.ClientEvents.UniEvents ->

function afterCreate(sender) 
{
    sender.expandFirstGroup = function() {
        try {
            sender.getView().features[0].expand(sender.getView().features[0].dataSource.data.items[0].groupKey)
        } catch (err) {}
    }
}

2. Usage:

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  UniDBGrid1.JSInterface.JSCall('expandFirstGroup', []);
end;

 

Link to comment
Share on other sites

On 9/29/2023 at 2:56 PM, Sherzod said:

Okay, you can try to use this approach:

1. UniDBGrid1.ClientEvents.UniEvents ->

function afterCreate(sender) 
{
    sender.expandFirstGroup = function() {
        try {
            sender.getView().features[0].expand(sender.getView().features[0].dataSource.data.items[0].groupKey)
        } catch (err) {}
    }
}

2. Usage:

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  UniDBGrid1.JSInterface.JSCall('expandFirstGroup', []);
end;

 

Yes!!! @Sherzod, works like a charm!  Thanks much..

 

  • Thanks 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...