Jump to content

Hide sort ascending/descending from column menu how?


Recommended Posts

Posted

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 :( 

Posted
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;

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

Posted
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?:

 

  • Like 1
Posted
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.

Posted
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()
        }
    );
}

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