Jump to content

TUniDBGrid Column Title Popupmenu


Masteritec

Recommended Posts

3 hours ago, Masteritec said:

Is it possible to let us to popupmenu at column title.

Current only allow us to popuomenu in cell content.

Please advice.

Hi,

You can try to use this approach.

1. UniMainModule.BrowserOptions.boDisableMouseRightClick = True

2. UniDBGrid1.ClientEvents.ExtEvents -> 

function headercontextmenu(ct, column, e, t, eOpts)
{
    ajaxRequest(this, "_hcmenu", ["x="+(e.clientX-this.getEl().getX()), 
                                  "y="+(e.clientY-this.getEl().getY())
    ]);
}

3. UniDBGrid1.OnAjaxEvent ->

procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
var
  X, Y: Integer;
begin
  if EventName = '_hcmenu' then
  begin
    X := Params.Values['x'].ToInteger();
    Y := Params.Values['y'].ToInteger();
    UniPopupMenu1.Popup(X, Y, Sender);
  end;

end;

 

Link to comment
Share on other sites

2 hours ago, Sherzod said:

Hi,

You can try to use this approach.

1. UniMainModule.BrowserOptions.boDisableMouseRightClick = True

2. UniDBGrid1.ClientEvents.ExtEvents -> 


function headercontextmenu(ct, column, e, t, eOpts)
{
    ajaxRequest(this, "_hcmenu", ["x="+(e.clientX-this.getEl().getX()), 
                                  "y="+(e.clientY-this.getEl().getY())
    ]);
}

3. UniDBGrid1.OnAjaxEvent ->


procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
var
  X, Y: Integer;
begin
  if EventName = '_hcmenu' then
  begin
    X := Params.Values['x'].ToInteger();
    Y := Params.Values['y'].ToInteger();
    UniPopupMenu1.Popup(X, Y, Sender);
  end;

end;

 

Great, It works

Thanks

Link to comment
Share on other sites

×
×
  • Create New...