使用 ui-grid 常量禁用滚动条 [英] Using ui-grid constants to disable scrollbars

查看:30
本文介绍了使用 ui-grid 常量禁用滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用最新版本的 ui-grid (v3.0.0-rc.16) 可以单独关闭水平和垂直滚动条.我通过交换获得了这个工作

With the latest version of ui-grid (v3.0.0-rc.16) it is possible to turn the horizontal and vertical scrollbar off seperately. I got this working by exchanging

$scope.gridOptions.enableScrollbars = false;

$scope.gridOptions.enableHorizontalScrollbar = 0;
$scope.gridOptions.enableVerticalScrollbar = 0;

在 ui-grid 的源代码中,为滚动条定义了三个常量:

In the sources of ui-grid there are three Constants defined for the scrollbars:

scrollbars: {
  NEVER: 0,
  ALWAYS: 1,
  WHEN_NEEDED: 2
}

面对 ui-grid 仍然不稳定且经常更改的事实,我会觉得使用这些常量而不是特定值会更舒服.但是我如何访问它们?

Facing the fact that ui-grid is still unstable and changed very often, i would feel more comfortable using those constants instead of the specific values. But how can i access them ?

Plunker:http://plnkr.co/edit/h0ewAZK616rKCH3T62te

推荐答案

在 github 上得到了我的答案:

Got my answer on github:

我需要做的就是像这样将 uiGridConstants 传递给我的控制器:

All I needed to do was to pass uiGridConstants to my controller like this:

angular.module('myApp').controller('myCtrl',function($scope,uiGridConstants) {
    ...

    $scope.gridOptions.enableHorizontalScrollbar = uiGridConstants.scrollbars.NEVER;

    ...
})

这篇关于使用 ui-grid 常量禁用滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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