Jump to content

Doubleclick on UniDBGrid - Grouping - Caption


Karsten

Recommended Posts

@Karsten @asapltda

Try this approach.

1. OnCreate ->

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  // Considering that the index of the grouping field will not change at run time...
  UniDBGrid1.JSInterface.JSAddListener(
    'afterrender',
    'function(sender){'+
    '   sender.getEl().on("dblclick", function(e, target, options) {'+
    '       ajaxRequest(sender, "groupTitleDblClick", {groupTitle: e.record.data['+ UniDBGrid1.DataSource.DataSet.FieldByName(UniDBGrid1.Grouping.FieldName).Index.ToString() +']})'+
    '   }, sender.getEl(), {'+
    '       preventDefault: true,'+
    '       delegate: ".x-grid-group-title"'+
    '   })'+
    '}'
  )

end;

2. OnAjaxEvent ->

procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  if EventName = 'groupTitleDblClick' then
    ShowMessage(Params.Values['groupTitle'])

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