andyhill Posted April 3, 2023 Share Posted April 3, 2023 I have a Grid with a Row Widget - ALL Good. How do I only allow one row expanded at a time ? This would require closing previous expanded row on current expansion. Also in code how do I expand All and Collapse All ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 3, 2023 Share Posted April 3, 2023 11 minutes ago, andyhill said: How do I only allow one row expanded at a time ? This would require closing previous expanded row on current expansion. Hello, Haven't tried searching the forum. This has already been discussed several times. Quote Link to comment Share on other sites More sharing options...
andyhill Posted April 3, 2023 Author Share Posted April 3, 2023 Yes I looked but failed to find the answer ? Quote Link to comment Share on other sites More sharing options...
andyhill Posted April 10, 2023 Author Share Posted April 10, 2023 Asking again, please advise how to Collapse ALL RowWidgets on DBGrid. // Collapse procedure TfMain.grdOutlineRowCollapse(Sender: TUniCustomDBGrid; const RowId: Integer; Container: TUniContainer); begin ExpandedID:= 0; end; // Expand procedure TfMain.grdOutlineRowExpand(Sender: TUniCustomDBGrid; const RowId: Integer; var RowControl: TControl; Container: TUniContainer); begin try ExpandedID:= (Sender as TUniDBGrid).DataSource.DataSet.FieldByName('OutlineID').AsInteger; RowControl:= TfOutlineDetail.Create(Container); except end; end; // Select procedure TfMain.grdOutlineSelectionChange(Sender: TObject); var ChkID: Integer; begin try ChkID:= (Sender as TUniDBGrid).DataSource.DataSet.FieldByName('OutlineID').AsInteger; if ( (ExpandedID > 0) and (ChkID <> ExpandedID) ) then begin grdOutline.CollapseAll(); ExpandedID:= 0; end; except end; end; How do I Collapse ALL RowWidgets ? grdOutline.CollapseAll(); Quote Link to comment Share on other sites More sharing options...
andyhill Posted April 12, 2023 Author Share Posted April 12, 2023 Hi Sherzod, can you please advise - thanks. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 12, 2023 Share Posted April 12, 2023 On 4/10/2023 at 12:16 PM, andyhill said: How do I Collapse ALL RowWidgets ? grdOutline.CollapseAll(); Hello, And how many records are on the grid? What you are asking may not be the correct usage for what this widget is for... Quote Link to comment Share on other sites More sharing options...
andyhill Posted April 13, 2023 Author Share Posted April 13, 2023 Hundreds and hundreds of records. I was advised to use RowWidgets as there is no true Master/Detail Grid Option (I do not want two permanent grids always showing). So using RowWidgets on Expand: the Frame has SQL data, therefore if more than one Row is expanded the SQL data is only valid on the latest expand. This can be simply resolved by OnExpand Event closing previously expanded Row if another row was expanded. 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.