Hide horizontal scrollbar (Angular ui-grid)

With the latest version on Github v3.0.0-rc.16 you can disable horizontal and vertical Scrollbar separately. Instead of

enableScrollbars = false;

use

enableHorizontalScrollbar = value; 
enableVerticalScrollbar = value;

with

value = 0; /* NEVER */
value = 1; /* ALWAYS */
value = 2; /* WHEN_NEEDED */

UPDATE: If you want to use constants instead of the integer-value, look at corresponding post:

Using ui-grid constants to disable scrollbars

UPDATE: The option WHEN_NEEDED doesn't seem to be available at the moment. Maybe this will be changed again, so please look for the available constants in the source code.

The Constants are defined in

https://github.com/angular-ui/ui-grid/blob/master/packages/core/src/js/constants.js


At now, the option WHEN_NEEDED doesn't seem to be available at the moment (ui-grid 3.1.1). So I have worked around by jQuery and CSS:

For simple, we just need do this:

.ui-grid .ui-grid-render-container-body .ui-grid-viewport {
    overflow-x: auto !important;
    /* or use: overflow-x: hide!important; */
}

To more flexible, we can use CSS class and jQuery. First, we add one more class:

.ui-grid-render-container-body .ui-grid-viewport.no-horizontal-bar {
    overflow-x: hidden !important;
}

In controller, we will use this class by jQuery:

$timeout(function(){
    if (!!$scope.gridOptions.data) {
        $('.ui-grid-render-container-body .ui-grid-viewport').addClass("no-horizontal-bar");
    }
});

To hide the blank gap when use selecting and grouping (http://i.imgur.com/veevhgQ.png), we use:

$timeout(function(){
    if (!!$scope.gridOptions.data) {
        /* To hide the blank gap when use selecting and grouping */
        $('.ui-grid-render-container-left .ui-grid-viewport').height($('.ui-grid-render-container-left .ui-grid-viewport').height() + 17);
        $('.ui-grid-render-container-body .ui-grid-viewport').addClass("no-horizontal-bar");
    }
});

With 17px is height of the gap when we use selecting and grouping feature.

Demo: http://plnkr.co/edit/D9PKPkvuRy2xA6UNNXCp?p=preview

With this solution we can show the horizontal bar again easily.