Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using ui-grid constants to disable scrollbars

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; 

with

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

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

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

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

like image 882
nabinca Avatar asked Nov 14 '14 19:11

nabinca


People also ask

How do I hide the UI scrollbar?

To remove the scrollbar from the React Material UI dialog, we can set the style prop of the DialogContent component. to set the style prop to an object that sets the overflow CSS property to 'hidden' . This will hide the scrollbar regardless of content size.

How do you get rid of scrollbar?

To hide the vertical scrollbar and prevent vertical scrolling, use overflow-y: hidden like so: HTML. CSS.

How do I get rid of the horizontal scroll bar on Ag grid?

gridOptions. api. sizeColumnsToFit(); This will set the columns width and hence remove horizontal scrolling.

How do I get rid of the scroll bar in SAP?

To disable horizontal scrolling, set the Horizontal Scrolling Enabled to false. To disable vertical scrolling, set the Vertical Scrolling Enabled to false.


2 Answers

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;      ... }) 
like image 52
nabinca Avatar answered Sep 19 '22 16:09

nabinca


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     }; } 
like image 35
Laura Riera Avatar answered Sep 19 '22 16:09

Laura Riera