从 ui-grid 列标题中删除排序菜单 [英] Remove sorting menu from ui-grid column header

查看:22
本文介绍了从 ui-grid 列标题中删除排序菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了具有三列的 ui-grid,默认情况下,列标题有一个v"形图标(在图像中以红色圆圈标记):

这里是代码和plunker:

var app = angular.module('app', ['ngTouch', 'ui.grid', 'ui.grid.expandable', 'ui.grid.selection', 'ui.grid.pinning']);app.controller('ThirdCtrl', ['$scope', '$http', '$log', function ($scope, $http, $log) {$scope.gridOptions = {expandableRowTemplate: 'expandableRowTemplate.html',可扩展行高度:150,onRegisterApi: 函数 (gridApi) {gridApi.expandable.on.rowExpandedStateChanged($scope, function (row) {如果(row.isExpanded){row.entity.subGridOptions = {列定义:[{名称:'名称'},{名称:'性别'},{名称:'公司'}]};$http.get('https://cdn.rawgit.com/angular-ui/ui-grid.info/gh-pages/data/100.json').成功(功能(数据){row.entity.subGridOptions.data = 数据;});}});}}$scope.gridOptions.columnDefs = [{ name: 'id', pinnedLeft:true },{名称:'名称'},{ 姓名年龄'},{名称:'地址.城市'}];$http.get('https://cdn.rawgit.com/angular-ui/ui-grid.info/gh-pages/data/500_complex.json').成功(功能(数据){$scope.gridOptions.data = 数据;});}]);

.grid {宽度:100%;高度:400px;}

<html ng-app="app"><头><script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.js"></script><script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular-touch.js"></script><script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular-animate.js"></script><script src="http://ui-grid.info/docs/grunt-scripts/csv.js"></script><script src="http://ui-grid.info/docs/grunt-scripts/pdfmake.js"></script><script src="http://ui-grid.info/docs/grunt-scripts/vfs_fonts.js"></script><script src="http://ui-grid.info/release/ui-grid.js"></script><link rel="stylesheet" href="http://ui-grid.info/release/ui-grid.css" type="text/css"><link rel="stylesheet" href="main.css" type="text/css"><身体><div ng-controller="ThirdCtrl"><div ui-grid="gridOptions" ui-grid-expandable class="grid"></div>

<script src="app.js"></script></html>

在我在项目中创建的网格上方的图像中.

我的问题是如何删除v"?登录红色圆圈的标题行?

解决方案

你想要的是:

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

I created ui-grid that has three columns, by default, the column header have a 'v' shaped icon (marked in red circle in the image) :

Here the code and the plunker:

var app = angular.module('app', ['ngTouch', 'ui.grid', 'ui.grid.expandable', 'ui.grid.selection', 'ui.grid.pinning']);


app.controller('ThirdCtrl', ['$scope', '$http', '$log', function ($scope, $http, $log) {
      $scope.gridOptions = {
        expandableRowTemplate: 'expandableRowTemplate.html',
        expandableRowHeight: 150,
        onRegisterApi: function (gridApi) {
            gridApi.expandable.on.rowExpandedStateChanged($scope, function (row) {
                if (row.isExpanded) {
                  row.entity.subGridOptions = {
                    columnDefs: [
                    { name: 'name'},
                    { name: 'gender'},
                    { name: 'company'}
                  ]};

                  $http.get('https://cdn.rawgit.com/angular-ui/ui-grid.info/gh-pages/data/100.json')
                    .success(function(data) {
                      row.entity.subGridOptions.data = data;
                    });
                }
            });
        }
      }

      $scope.gridOptions.columnDefs = [
        { name: 'id', pinnedLeft:true },
        { name: 'name'},
        { name: 'age'},
        { name: 'address.city'}
      ];

      $http.get('https://cdn.rawgit.com/angular-ui/ui-grid.info/gh-pages/data/500_complex.json')
        .success(function(data) {
          $scope.gridOptions.data = data;
        });
    }]);

.grid {
  width: 100%;
  height: 400px;
}

<!doctype html>
<html ng-app="app">
  <head>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular-touch.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular-animate.js"></script>
    <script src="http://ui-grid.info/docs/grunt-scripts/csv.js"></script>
    <script src="http://ui-grid.info/docs/grunt-scripts/pdfmake.js"></script>
    <script src="http://ui-grid.info/docs/grunt-scripts/vfs_fonts.js"></script>
    <script src="http://ui-grid.info/release/ui-grid.js"></script>
    <link rel="stylesheet" href="http://ui-grid.info/release/ui-grid.css" type="text/css">
    <link rel="stylesheet" href="main.css" type="text/css">
  </head>
  <body>


<div ng-controller="ThirdCtrl">
   <div ui-grid="gridOptions" ui-grid-expandable class="grid"></div>
</div>


    <script src="app.js"></script>
  </body>
</html>

In the image above the grid I have created in my project.

My question is how can I remove the "v" sign in header row in red circle?

解决方案

What you want is:

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

这篇关于从 ui-grid 列标题中删除排序菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆