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;

 

  • Like 1
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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...