Jump to content

unidbgrid


jahlxx

Recommended Posts

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.

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...