2013-10-01 59 views
0

我應該在網格 我有了這個代碼顯示的圖像:angularjs NG-電網如何設置行或單元格高度

$scope.gridOptions = { 
      data: 'items', 
      enablePaging: true, 
      showFooter: true, 
      enablePinning: true, 
      totalServerItems:'totalServerItems', 
      pagingOptions: $scope.pagingOptions, 
      filterOptions: $scope.filterOptions, 
      showSelectionCheckbox: true, 
      multiSelect: false, 
      rowTemplate: '<div ng-style="{\'cursor\': row.cursor, \'z-index\': col.zIndex(),\'height\': \'150px\' }" ng-repeat="col in renderedColumns" ng-class="col.colIndex()" class="ngCell {{col.cellClass}}" ng-cell></div>', 
      columnDefs: [ 
        {field: 'id', displayName: 'Id'}, 
        {field:'firstname', displayName:'Name'}, 
        {field: 'surname', displayName:'Cognome'}, 
        {field: 'email', displayName:'Email'}, 
        {field: 'address', displayName:'Indirizzo'}, 
        {field: 'city', displayName:'Città'}, 
        {field: 'zip', displayName:'Cap'}, 
        {field: 'birthday', displayName:'Data di nascita'}, 
        {field: 'joined', displayName:'Registrazione'}, 
        {field: 'ip', displayName:'Ip'}, 
        {field: 'url', displayName:'Prodotto',cellTemplate: '<div class="ngCellText" ng-class="col.colIndex()"><img src="./assets/base/img/products/{{row.getProperty(\'url\')}}" /></div>'}, 
       ] 
      }; 

    }); 

所有作品圖像高度以及節選(它顯示有該行高度)

我已經與

rowTemplate: '<div ng-style="{\'cursor\': row.cursor, \'z-index\': col.zIndex(),\'height\': \'150px\' }" ng-repeat="col in renderedColumns" ng-class="col.colIndex()" class="ngCell {{col.cellClass}}" ng-cell></div>', 

或者乾脆試圖把風格的DIV IMG模板

但它不起作用 所以有沒有辦法設置行/單元格的高度?

回答

8

這很簡單,如果你知道^^

$scope.gridOptions = { 
      data: 'items', 
      rowHeight: 80, 
      enablePaging: true, 
      showFooter: true, 
      enablePinning: true, 
      totalServerItems:'totalServerItems', 
      pagingOptions: $scope.pagingOptions, 
      filterOptions: $scope.filterOptions, 
      showSelectionCheckbox: true, 
      multiSelect: false, 
      columnDefs: [ 
        {field: 'id', displayName: 'Id'}, 
        {field:'firstname', displayName:'Name'}, 
        {field: 'surname', displayName:'Cognome'}, 
        {field: 'email', displayName:'Email'}, 
        {field: 'address', displayName:'Indirizzo'}, 
        {field: 'city', displayName:'Città'}, 
        {field: 'zip', displayName:'Cap'}, 
        {field: 'birthday', displayName:'Data di nascita'}, 
        {field: 'joined', displayName:'Registrazione'}, 
        {field: 'ip', displayName:'Ip'}, 
        {field: 'url', displayName:'Prodotto',cellTemplate: '<div class="ngCellText" ng-class="col.colIndex()"><img src="./assets/base/img/products/{{row.getProperty(\'url\')}}" /></div>'}, 
       ] 
      }; 

    }); 

只需添加的rowHeight:80,以網格選項

+1

細胞不共享行的高度,它們默認爲30PX – brimble2010

+0

爲單元格問題,添加與高度cellemplate:繼承像這樣:cellTemplate:'

{{row.entity.id}}
' – I3i0

相關問題