mierlp Posted April 11, 2016 Share Posted April 11, 2016 hi is there a way to clear all the selected rows in a dbgrid. Normally you can use: uniDBGrid.SelectedRows.Clear Greetz Peter 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 12, 2016 Share Posted April 12, 2016 is there a way to clear all the selected rows in a dbgrid. Hi, For now, you can use like this: procedure TMainForm.btnClear(Sender: TObject); begin UniSession.AddJS(UniDBGrid1.JSName + '.getSelectionModel().deselectAll()'); end; Best regards. Quote Link to comment Share on other sites More sharing options...
mierlp Posted April 12, 2016 Author Share Posted April 12, 2016 Thanks...works Quote Link to comment Share on other sites More sharing options...
Javi Posted April 19, 2016 Share Posted April 19, 2016 It works ... But "deselectAll" only works when thrown at another event. /////////////////////////////// // It work procedure TMainForm.UniFormActivate(Sender: TObject); begin UniDBGrid1.DataSource.DataSet.Close; UniDBGrid1.DataSource.DataSet.Open; end; procedure TMainForm.btn1Click(Sender: TObject); begin UniSession.AddJS(UniDBGrid1.JSName + '.getSelectionModel().deselectAll()'); end; /////////////////////////////// /////////////////////////////// // It doesn't work procedure TMainForm.UniFormActivate(Sender: TObject); begin UniDBGrid1.DataSource.DataSet.Close; UniDBGrid1.DataSource.DataSet.Open; // It doesn't work UniSession.AddJS(UniDBGrid1.JSName + '.getSelectionModel().deselectAll()'); end; /////////////////////////////// Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 20, 2016 Share Posted April 20, 2016 It works ... But "deselectAll" only works when thrown at another event. /////////////////////////////// // It doesn't work procedure TMainForm.UniFormActivate(Sender: TObject); begin UniDBGrid1.DataSource.DataSet.Close; UniDBGrid1.DataSource.DataSet.Open; // It doesn't work UniSession.AddJS(UniDBGrid1.JSName + '.getSelectionModel().deselectAll()'); end; /////////////////////////////// Hi, Try to use UniDBGrid1->OnAfterLoad event: procedure TMainForm.UniDBGrid1AfterLoad(Sender: TUniDBGrid); var DBGridJSName: string; begin DBGridJSName := UniDBGrid1.JSName; UniSession.AddJS('setTimeout(function(){'+ DBGridJSName +'.getSelectionModel().deselectAll()}, 50)'); end; Best regards. 1 Quote Link to comment Share on other sites More sharing options...
Javi Posted April 20, 2016 Share Posted April 20, 2016 Thank you very much for the help. 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.