Using ui-grid constants to disable scrollbars

 ̄綄美尐妖づ 提交于 2019-12-02 22:06:31
nabinca

Got my answer on github:

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;

    ...
})
Laura Riera

With John Papa style:

ExampleController.$inject = ['$scope', 'uiGridConstants'];
function ExampleController($scope, uiGridConstants) {
    var vm = this;

    vm.gridOptions = {
        enableHorizontalScrollbar : uiGridConstants.scrollbars.NEVER,
        enableVerticalScrollbar   : uiGridConstants.scrollbars.NEVER
    };
}

A workaround for this (since WHEN_NEEDED is currently disabled) is to set enableHorizontalScrollbar: 0 on your gridOptions and then in your stylesheet have the following:

.ui-grid .ui-grid-render-container-body .ui-grid-viewport {
  overflow-x: auto !important;
}

Now the horizontal scroll bar only displays when needed.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!