Jump to content

Check Key in OnColumnSort Event


Ario.Paxaz

Recommended Posts

Hi,

 

Maybe through with "global" listeners:

 

1.

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  with UniDBGrid1 do
  begin
    UniSession.AddJS('document.addEventListener("keydown", function(e){if (e.ctrlKey){ajaxRequest('+JSName+', "_keydownup", ["ctrlKey="+e.ctrlKey])}})');
    UniSession.AddJS('document.addEventListener("keyup", function(e){if (!e.ctrlKey){ajaxRequest('+JSName+', "_keydownup", ["ctrlKey="+e.ctrlKey])}})');
  end;
end;

2.

public
  { Public declarations }
  ctrlKey: Boolean;
end;

3.

procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  if EventName = '_keydownup' then
    ctrlKey := StrToBool(Params.Values['ctrlKey'])

end;

4.

procedure TMainForm.UniDBGrid1ColumnSort(Column: TUniDBGridColumn;
  Direction: Boolean);
begin
  if ctrlKey then ...
end;
Link to comment
Share on other sites

Let me remind that using JS code proposed by our moderator above should be done at your own risk.

We can't guarantee that above code will work, fit your purpose and will be compatible with future versions of Ext JS.

 

Thanks

 

Yes, he's right!

 

And forgive me, that I give you such decisions :)

it is better to open a request in our support portal, we will try to realise this feature

 

Best regards,

Link to comment
Share on other sites

Better use like this:

 

1. UniForm -> KeyPreview = True

 

2.

public
  { Public declarations }
  ctrlKey: Boolean;
end;

3.

procedure TMainForm.UniFormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  ctrlKey := ssCtrl in Shift;
end;

procedure TMainForm.UniFormKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  ctrlKey := ssCtrl in Shift;
end;

4.

procedure TMainForm.UniDBGrid1ColumnSort(Column: TUniDBGridColumn;
  Direction: Boolean);
begin
  if ctrlKey then ...
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...