Search code examples
javascriptangularjssyncfusion

How to set minimum height of syncfusion grid using Angular js?


I am working on syncfusion grid (third party custom controls) using Angularjs in my current project.

I have one little issue with grid regarding height. I have done some angular code that set height of grid (I use "e-scrollsettings-height" attribute to do so) but it will make grid blank when grid is empty you can see attached screen shot for make sense.

enter image description here

One thing is I don't want to use paging in my grid.

I think maybe there is some attribute for min-height but I don't find any related attribute.


Solution

  • Finally i got an answer so i am posting here for others

    in view:

    <div class="gridStyle" ng-init="getList()" ma-cmis-grid-directive id="cmisGrid" e-scrollsettings-height="{{maximumGridHeight}}" e-actioncomplete="actioncomplete"></div>
    

    in script file:

    $scope.maximumGridHeight = 330;
    $scope.actioncomplete = function (args) {
        if (!this.initialRender && args.requestType == "refresh") {
                var height = Math.ceil(this.getRowHeight() * this.model.currentViewData.length);
                this.option("model.scrollSettings.height", height > $scope.maximumGridHeight ? $scope.maximumGridHeight : height);
            }
            else if (args.requestType != "sorting" && this.model.selectionType == "single")
            {
                var height = Math.ceil(this.getRowHeight() * this.model.currentViewData.length);
                this.option("model.scrollSettings.height", height > $scope.maximumGridHeight ? $scope.maximumGridHeight : height);
            }
    }