Remove sorting menu from ui-grid column header

最后都变了- 提交于 2019-12-03 22:10:46

What you want is:

$scope.gridOptions = {
    enableColumnMenus: false
    ...
}
madan

If you want to remove it from all column do the following as suggested by Chris:

    $scope.gridOptions = {
        enableColumnMenus: false
        ...
    }

But if you want to remove it from one or more but not all columns you need

 $scope.gridOptions = {
    columnDefs: [
        {                    
            enableColumnMenu: false,
    ...
}

Note that the default value of enableColumnMenus is true.

You can disable sorting

    $scope.gridOptions = {
           enableSorting: false,
           .. 
    }

I managed this by specifying enableSorting: false on the relevant column definition, this is contrary to the documentation which specified sortable: false.

var uiGrid = [];
var columnsUiGrid = [
    { displayName: 'Column A', field: 'model.ColumnA' },
    { displayName: 'Column B', field: 'model.ColumnB', enableSorting: false }
];

$scope.uiGridOptions = {
    enableSorting: true,
    columnDefs: columnsUiGrid,
    data: uiGrid
};
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!