2017-05-25 55 views
1

我被困在一個點,我想要使用ng-table動態打印小標題標題,標題應該是type1 type2 type3,而細節必須是主頭,子類型值必須是小標題詳見下圖附件enter image description hereangular - 動態打印ng-table標題

任何幫助都大大提升。

+0

Plunker - https://plnkr.co/edit/rLOWTCxXKyhKM2suxIBA?p=preview – Praveen

回答

0

嘗試了這一點: https://plnkr.co/edit/gypa0JDAZqhNwWcRQK93?p=preview

  <body ng-controller="MainCtrl"> 
       <p>Hello {{name}}!</p> 
       <table ng-table="tableParams"> 
       <tr> 
        <td colspan="3"></td> 
        <td colspan="{{detailsCount}}" style="text-align:center">Details</td> 
       </tr> 
       <tr ng-repeat="i in dataObject"> 
        <td title="'Type1'">{{i.type1}}</td> 
        <td title="'Type2'">{{i.type2}}</td> 
        <td title="'Type3'">{{i.type3}}</td> 
        <td ng-repeat="d in i.details" ng-init="detailsColCount(i.details)">{{d.subTypeCode}}</td> 
       </tr> 
       </table> 
      </body> 

      $scope.detailsCount = 0; 
      $scope.detailsColCount = function(details){ 
        if (details.length > $scope.detailsCount) { 
        $scope.detailsCount = details.length; 
        } 
       }; 
+0

感謝你對這個花費時間,但我更關心的標題,像 – Praveen

+0

類似type1 type2 type3 abcd與ABCD a1 b1 c1 d1作爲下方的記錄,明顯的'細節'標題頂部abc d。 – Praveen