Jump to content

Get Cell When User Changes the Cell of Grid


bruno-pere

Recommended Posts

Hi!

 

I need to get the row and col when the user selects a new cell in the grid. The user can change using mouse or keyboard.

 

Anyone know how to get this?

 

I tried using OnCellClick but it fires only when the user clicks the mouse. I need to get after using the keyboard too.

 

Thank you!

 

Bruno

Link to comment
Share on other sites

Thank you!

 

Solved here too.

 

function OnCellclick(sender, rowIndex, columnIndex, e)
{
  var me = MainForm.UniDBGrid1;
  pos = me.getSelectionModel().getCurrentPosition();
  //alert(pos.column);
 
  ajaxRequest(MainForm.UniDBGrid1,
              'CellChanged',
              ['col='+pos.column,'row='+pos.row]);
}

 

 

function OnKeypress(e)
{
  var me = MainForm.UniDBGrid1;
  pos = me.getSelectionModel().getCurrentPosition();
  //alert(pos.column);
 
  ajaxRequest(MainForm.UniDBGrid1,
              'CellChanged',
              ['col='+pos.column,'row='+pos.row]);
}

 

 

 

 

OnAjaxEvent

 

var
  col, row: string;
begin
  if EventName='CellChanged' then
  begin
    col := Params.Values['col'];
    row := Params.Values['row'];
    if (UpperCase(col)<>'UNDEFINED')and(UpperCase(row)<>'UNDEFINED') then
    begin
        UniLabel1.Text := 'Col: ' + col + ', Row: ' + row;

    end;

end;

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...