Jump to content

add new ItemMenu to Grid Column SortMenu


Recommended Posts



You can try this:

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

Best regards,

Link to comment
Share on other sites



I manage to find a JS code: 

function afterCreate(sender)
  var menu = sender.headerCt.getMenu();
     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

Nothing is fired in onAjaxEvent while clicking in headerMenu :(


ps: I misread, you meant the onAjaxEvent event of the grid or a JS workaround ? If so, could you be more precise, please ? :o


Edit: I got the idea( http://forums.unigui.com/index.php?/topic/9262-javascript-event-sender-in-ajaxrequest/?p=47899), thanks  ^_^

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.

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