简体   繁体   English

AngularJS ng-grid聚集在一起的网格

[英]AngularJS ng-grid clumping together grid

I'm trying to do a basic ng-grid . 我正在尝试做一个基本的ng-grid I have it is defined and it has data. 我已经定义了并且它有数据。 I'll attach a picture too, I haven't ever seen ng-grid do this, but this is the first time I'm setting it up myself so maybe I'm doing it wrong. 我也会附上一张图片,我从未见过ng-grid这样做,但这是我第一次自己进行设置,所以也许我做错了。 Here's my code: 这是我的代码:

My Controller: 我的控制器:

    controllers.controller('searchResultsController', ['$scope', '$rootScope',
    function($scope, $rootScope) {

        $scope.data = $scope.searchResults.data || $rootScope.searchResults.data;
        $scope.resultsGridOptions = {
            data: 'data',
            columnDefs: [
                {
                    field: 'startingCity',
                    displayName: 'Starting City',
                    width: '***'
                },
                {
                    field: 'destination',
                    displayName: 'Destination',
                    width: '***'
                },
                {
                    field: 'airline',
                    displayName: 'Airline',
                    width: '**'
                },
                {
                    field: 'price',
                    displayName: 'Price',
                    width: '*'
                },
                {
                    field: 'seatsInFirstClass',
                    displayName: 'Seats In First Class',
                    width: '*'
                },
                {
                    field: 'seatsInEconomy',
                    displayName: 'Seats In Economy',
                    width: '*'
                }
            ]
        };
    }
]
);

My app declaration: 我的应用程式声明:

angular.module('reservationsApp', ['ngRoute', 'ngGrid', 'ui.bootstrap', 'reservationsControllers']);

And if it'll do any good, my template (pretty plain though): 如果可以,我的模板(虽然很简单):

<div class="gridStyle" ng-grid="resultsGridOptions"></div>

Here's a screenshot of what I'm getting 这是我得到的屏幕截图

I figured it out, well, @GregL figured it out. 我想通了,@ GregL弄清楚了。 I wasn't importing the ng-grid.css file correctly. 我没有正确导入ng-grid.css文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM