pade Posted September 9, 2020 Share Posted September 9, 2020 I want to hide sort ascending/descending menu choices from the column menu and keep the columns menu choice. I can't figure out how to do this Quote Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted September 9, 2020 Share Posted September 9, 2020 2 hours ago, pade said: I want to hide sort ascending/descending menu choices from the column menu and keep the columns menu choice. I can't figure out how to do this Hi, Column-> Menu -> MenuEnabled := False; Quote Link to comment Share on other sites More sharing options...
pade Posted September 9, 2020 Author Share Posted September 9, 2020 58 minutes ago, Hayri ASLAN said: Hi, Column-> Menu -> MenuEnabled := False; Yeah that had worked if I wanted to get rid of all menuchoices. The thing is that I want to keep the columns menuchoice. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 9, 2020 Share Posted September 9, 2020 2 hours ago, pade said: Yeah that had worked if I wanted to get rid of all menuchoices. The thing is that I want to keep the columns menuchoice. Can you try this old approach?: 1 Quote Link to comment Share on other sites More sharing options...
pade Posted September 10, 2020 Author Share Posted September 10, 2020 16 hours ago, Sherzod said: Can you try this old approach?: It works perfectly. But now I wonder if it is possible to have different column menus. That is some where you can sort and some where you cannot or is there only one menu def for the columns in the grid. I realize that I should have mentioned this earlier. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 10, 2020 Share Posted September 10, 2020 2 hours ago, pade said: or is there only one menu def for the columns in the grid Yes. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 10, 2020 Share Posted September 10, 2020 2 hours ago, pade said: But now I wonder if it is possible to have different column menus. That is some where you can sort and some where you cannot OK. Let's assume we don't want to show sort items for the first column. 1. UniDBGrid.ClientEvents.ExtEvents -> function afterrender(sender, eOpts) { var menu = sender.headerCt.getMenu(); if (menu) { menu.on('beforeShow', ()=> { menu.items.each(function(item) { if (item.itemId != 'columnItem' && menu.activeHeader.needToHideSortDesc) { item.hide() } else { item.show() } }); }) } } 2. procedure TMainForm.UniFormReady(Sender: TObject); begin with UniDBGrid1 do JSInterface.JSConfig('needToHideSortDesc', [True], Columns[0].JSColumn) end; 3. function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { sender.headerCt.getMenu().items.each( function(item){ if (item.itemId != 'columnItem') item.hide() } ); } 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.