Jump to content

Hide sort ascending/descending from column menu how?


pade

Recommended Posts

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.

Link to comment
Share on other sites

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

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