jahlxx Posted June 27, 2016 Posted June 27, 2016 Hi. Is there any option to intereac directly with a dbgris, like in excel? In oder grids in vcl apps. I can, but in unidbgrid, I don't know why. I can't find any opcion. Readonly is false, readonly on dataset is false, ..... Some help please. Quote
Sherzod Posted June 27, 2016 Posted June 27, 2016 Hi, I'm sorry, can you clarify your question again.. ?! Best regards. Quote
jahlxx Posted June 27, 2016 Author Posted June 27, 2016 OK. If other dbgrids, I can interact with it with the keyboard to insert one row, delete one row, modify, etc. When I am in the last row in a dbgrid, and press the key down, the grid inserts a blank row and puts the dataset in insert mode. In vcl apps I user the dbgrid included in unidac components. With unidbgrid, I can't find the way to do it. The readonly properties of the grid and the dataset linked, ar false. The only way I see is unidbnavigator, but is not the same. Quote
Sherzod Posted June 27, 2016 Posted June 27, 2016 Hi, if I understand correctly you, can you try this approach: ?! 1. UniDBGrid1->WebOptions->Paged = False 2. UniDBGrid1->ClientEvents->ExtEvents ... keydown fn: function keydown(sender, key, shift, eOpts) { if (sender.button == 39 && this.getSelectionModel().getSelection()[0] == this.getStore().last()){ ajaxRequest(this.headerCt.grid, '_last', []); } } 3. UniDBGrid1->onAjaxEvent: procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = '_last' then begin // your logic, for example (Sender as TUniDBGrid).DataSource.DataSet.Insert; end; end; Best regards. Quote
Sherzod Posted June 27, 2016 Posted June 27, 2016 Or better: procedure TMainForm.UniDBGrid1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); var isLastRecord: Boolean; begin isLastRecord := (Sender as TUniDBGrid).DataSource.DataSet.RecNo = (Sender as TUniDBGrid).DataSource.DataSet.RecordCount; if (Key = VK_DOWN) and (isLastRecord) then begin // your logic (Sender as TUniDBGrid).DataSource.DataSet.Insert; end; end; Try... Best regards. 1 Quote
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.