Jump to content

Recommended Posts

Posted

Hello everyone ! (:

 

Is it possible to add another entry to the 'sort menu' of a tUniDBGrid?

For instance, in my case I would like to add an entry in order to cancel a sort on a specific column !

 

How would I do that ?  -_-

Posted

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,

Posted

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

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