M477H13U Posted October 23, 2017 Share Posted October 23, 2017 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 ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 23, 2017 Share Posted October 23, 2017 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, Quote Link to comment Share on other sites More sharing options...
M477H13U Posted October 23, 2017 Author Share Posted October 23, 2017 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 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 23, 2017 Share Posted October 23, 2017 Use ajaxRequest Quote Link to comment Share on other sites More sharing options...
M477H13U Posted October 23, 2017 Author Share Posted October 23, 2017 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 ? Edit: I got the idea( http://forums.unigui.com/index.php?/topic/9262-javascript-event-sender-in-ajaxrequest/?p=47899), thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.