Freeman35 Posted November 5, 2018 Share Posted November 5, 2018 Hello, How to FullCollaps / FullExpand grouped TUniDBGrid ? I wanna after open dataset, Collaps all group. How can I do this? Thank you. Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted November 5, 2018 Share Posted November 5, 2018 dbgrid_cadastro.FullExpand; dbgrid_cadastro.FullCollapse; Quote Link to comment Share on other sites More sharing options...
Freeman35 Posted November 6, 2018 Author Share Posted November 6, 2018 Hello eduardosuruagy, I'm using v.1480. And asked for TUniDBGrid, are you sure this version and class has it ? thank you. Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted November 6, 2018 Share Posted November 6, 2018 I'm also using this version. UniDBGrid.FullExpand; UniDBGrid.FullCollapse; Quote Link to comment Share on other sites More sharing options...
Freeman35 Posted November 6, 2018 Author Share Posted November 6, 2018 So strange, [dcc32 Error] ufrm.pas(133): E2003 Undeclared identifier: 'FullCollapse' And search in unigui, only TreeGrid and TreeView has this procedure. Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted November 6, 2018 Share Posted November 6, 2018 sorry, I'm actually using UniDBTreeGrid Quote Link to comment Share on other sites More sharing options...
Sherzod Posted November 6, 2018 Share Posted November 6, 2018 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; 1 Quote Link to comment Share on other sites More sharing options...
Freeman35 Posted November 6, 2018 Author Share Posted November 6, 2018 Thank you so much, I didn't understand css, why need thats? its work without add that. Regards. Quote Link to comment Share on other sites More sharing options...
fraxzi Posted September 29, 2023 Share Posted September 29, 2023 Hi @Sherzod, How to expand the first group? Thanks, Frances Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 29, 2023 Share Posted September 29, 2023 3 minutes ago, fraxzi said: How to expand the first group? Hello, What are your grid settings? Quote Link to comment Share on other sites More sharing options...
fraxzi Posted September 29, 2023 Share Posted September 29, 2023 2 hours ago, Sherzod said: Hello, What are your grid settings? Hi, dbgrid-> grouping -> collapsible, summary -> grandtotal Just normal dbgrid with grouping and summary. Thanks, Frances Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 29, 2023 Share Posted September 29, 2023 2 minutes ago, fraxzi said: dbgrid-> grouping -> collapsible, summary -> grandtotal Just normal dbgrid with grouping and summary. Options -> dgEditing = ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 29, 2023 Share Posted September 29, 2023 2 hours ago, fraxzi said: How to expand the first group? Isn't everything expanded by default? Quote Link to comment Share on other sites More sharing options...
fraxzi Posted September 29, 2023 Share Posted September 29, 2023 47 minutes ago, Sherzod said: Isn't everything expanded by default? Hi, Yes all expanded.. I copied the code above to collapsed and it did. i just want to expand the first group by code. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 29, 2023 Share Posted September 29, 2023 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; Quote Link to comment Share on other sites More sharing options...
fraxzi Posted October 3, 2023 Share Posted October 3, 2023 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.. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.