Jump to content

Solution - UniDBGrid Goto Next Record (Row) after Edit


Recommended Posts

Posted
Hi All ... 

 

One of the solutions ... (Can be useful to someone) 

 

After editing the grid, move to the next cell to the next line. 

 

 

1. UniDBGrid1 -> ExtEvents -> 


function edit(editor, context, eOpts)
{   
  ajaxRequest(this, 'modified', []); 
}

2.



procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TStrings);
begin
  if (EventName = 'modified') and
     (UniDBGrid1.DataSource.DataSet.RecNo <> UniDBGrid1.DataSource.DataSet.RecordCount)
  then begin
    if UniDBGrid1.WebOptions.Paged then UniSession.AddJS('if (('+UniDBGrid1.JSName+'.getStore().pageSize - 1) != '+UniDBGrid1.JSName+'.uniRow){'+UniDBGrid1.JSName+'.getSelectionModel().setCurrentPosition({row: '+UniDBGrid1.JSName+'.uniRow + 1, column: '+UniDBGrid1.JSName+'.uniCol})} else {'+UniDBGrid1.JSName+'.getStore().nextPage(1);'+UniDBGrid1.JSName+'.uniRow = 0};')
    else UniSession.AddJS(UniDBGrid1.JSName+'.getSelectionModel().setCurrentPosition({row: '+UniDBGrid1.JSName+'.uniRow + 1, column: '+UniDBGrid1.JSName+'.uniCol});')
  end;
end;


Sincerely...

  • Upvote 1

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