Jump to content

add new ItemMenu to Grid Column SortMenu


M477H13U

Recommended Posts

Hi,

 

You can try this:

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  with UniDBGrid1.JSInterface do
    JSAddListener('viewready',  JSFunction('me', 'me.headerCt.getMenu().insert(2, {id: "myID", itemId:"myItemId", text: "myitem", handler: function(){alert(this.id)}})'));
end;

Best regards,

Link to comment
Share on other sites

Yeah,

 

I manage to find a JS code: 

function afterCreate(sender)
{
  var menu = sender.headerCt.getMenu();
  menu.add([{
     text: 'Custome Item',
     handler: function() {
     var columnDataIndex = menu.activeHeader.dataIndex;
     alert('custom item for column "'+columnDataIndex+'" was pressed');
     }
  }]); 
}
But I prefer your version as my manager does not like JS .. (:
My next step now would be to bind the JS handler to a Delphi event; would that be possible ? :3
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...