bbm Posted May 26, 2022 Share Posted May 26, 2022 Hi all, I am using Delphi 10.2 and unuGUI version 1.90.0.1551. I have activated the RowWidget in a DBGrid Is it possible to close an opened row widget by opening another one. Best regards Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 26, 2022 Share Posted May 26, 2022 Hello, Have you tried searching the forum? Quote Link to comment Share on other sites More sharing options...
bbm Posted May 26, 2022 Author Share Posted May 26, 2022 Hi, I didn't find any. It sounds to me like there is no easy solution. I'll try to find a workaround myself. Thanks! Best regards Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 26, 2022 Share Posted May 26, 2022 4 hours ago, bbm said: Is it possible to close an opened row widget by opening another one. Hello, Here is the solution: 1. UniDBGrid1.ClientEvents.ExtEvents -> function afterrender(sender, eOpts) { sender.view.rowExpander.collapseRow = function(rowIdx) { var rowNode = this.view.getNode(rowIdx), row = Ext.get(rowNode), nextBd = Ext.get(row).down(this.rowBodyTrSelector), record = this.view.getRecord(rowNode), grid = this.getCmp(); if (!row.hasCls(this.rowCollapsedCls)) { row.addCls(this.rowCollapsedCls); nextBd.addCls(this.rowBodyHiddenCls); this.recordsExpanded[record.internalId] = false; this.view.fireEvent('collapsebody', rowNode, record, nextBd.dom); } }; } 2. private { Private declarations } FPrevRowID: Integer; 3. procedure TMainForm.UniFormCreate(Sender: TObject); begin FPrevRowID := -1; end; 4. procedure TMainForm.UniDBGrid1RowExpand(Sender: TUniCustomDBGrid; const RowId: Integer; var RowControl: TControl; Container: TUniContainer); begin if FPrevRowID=-1 then begin FPrevRowID := RowId end else begin UniDBGrid1.JSInterface.JSCall('view.rowExpander.collapseRow', [FPrevRowID]); FPrevRowID := RowId; end; RowControl := TDetailFrame.Create(Container); end; 5. procedure TMainForm.UniDBGrid1RowCollapse(Sender: TUniCustomDBGrid; const RowId: Integer; Container: TUniContainer); begin if FPrevRowID=RowId then FPrevRowID := -1; end; Quote Link to comment Share on other sites More sharing options...
bbm Posted May 27, 2022 Author Share Posted May 27, 2022 Hi Sherzod, thank you very much for your support 👍! Best regards 1 Quote Link to comment Share on other sites More sharing options...
fraxzi Posted January 26 Share Posted January 26 On 5/26/2022 at 11:42 PM, Sherzod said: Hello, Here is the solution: 1. UniDBGrid1.ClientEvents.ExtEvents -> function afterrender(sender, eOpts) { sender.view.rowExpander.collapseRow = function(rowIdx) { var rowNode = this.view.getNode(rowIdx), row = Ext.get(rowNode), nextBd = Ext.get(row).down(this.rowBodyTrSelector), record = this.view.getRecord(rowNode), grid = this.getCmp(); if (!row.hasCls(this.rowCollapsedCls)) { row.addCls(this.rowCollapsedCls); nextBd.addCls(this.rowBodyHiddenCls); this.recordsExpanded[record.internalId] = false; this.view.fireEvent('collapsebody', rowNode, record, nextBd.dom); } }; } 2. private { Private declarations } FPrevRowID: Integer; 3. procedure TMainForm.UniFormCreate(Sender: TObject); begin FPrevRowID := -1; end; 4. procedure TMainForm.UniDBGrid1RowExpand(Sender: TUniCustomDBGrid; const RowId: Integer; var RowControl: TControl; Container: TUniContainer); begin if FPrevRowID=-1 then begin FPrevRowID := RowId end else begin UniDBGrid1.JSInterface.JSCall('view.rowExpander.collapseRow', [FPrevRowID]); FPrevRowID := RowId; end; RowControl := TDetailFrame.Create(Container); end; 5. procedure TMainForm.UniDBGrid1RowCollapse(Sender: TUniCustomDBGrid; const RowId: Integer; Container: TUniContainer); begin if FPrevRowID=RowId then FPrevRowID := -1; end; Hi @Sherzod, I tried the above (as is) works well with on-screen rows (I am using .1579) but when I left an open widget and scroll down to open another row it prompts ajax error: Also, in Grouped dbGrid, if I open row widget on, say, group 1 then open another widget from group 2, the widget willl not expand then the rest of the row widget wont open. Hoping for your assistance. Thanks, Frances Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 26 Share Posted January 26 Hello, I will try to check. 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.