2017-04-05 14 views
0

我在AngularJS中有一個ng表。單擊ng-table中的一個特定行並加載該行的數據

<table ng-table="fondiTable" class="table table-condensed table-bordered table-striped" show-filter="isFiltersVisible"> 
     <tr ng-repeat="fondo in data | filter:getChiave | filter:getRapporto"> 
      <td class="dropdown"> 
       <a class="dropdown-toggle" data-toggle="dropdown"><i class="glyphicon glyphicon-th-list"></i></a> 
        <ul class="dropdown-menu"> 
         <li><a><i class="glyphicon glyphicon-search"></i> Visualizza</a></li> 
         <li><a><i class="glyphicon glyphicon-pencil"></i> Modifica</a></li> 
         <li class="disabled"><a><i class="glyphicon glyphicon-trash"></i> Cancella</a></li> 
        </ul> 
      </td> 
      <td class="i9font text-center" data-title="'Data Rif'" header-class="'i9header'" filter="{dataRif: 'text'}" sortable="'dataRif'">{{fondo.dataRif}}</td> 
      <td class="i9fontPre text-center" data-title="'Chiave IB'" header-class="'i9header'" filter="{chiave: 'text'}" sortable="'chiave'">{{fondo.chiave}}</td>  
      <td class="i9font text-center" data-title="'Stato Pratica'" header-class="'i9header'" filter="{stato: 'text'}" sortable="'stato'">{{fondo.stato}}</td> 
      <td class="i9font text-center" data-title="'Flag S/V'" header-class="'i9header'" filter="{fvs: 'text'}" sortable="'fvs'">{{fondo.fvs}}</td> 
      <td class="i9font text-right" data-title="'Fondo bucket 1 (EUR)'" header-class="'i9header'" filter="{fnd1: 'text'}" sortable="'fnd1'">{{fondo.fnd1}}</td> 
      <td class="i9font text-right" data-title="'Fondo bucket 2 (EUR)'" header-class="'i9header'" filter="{fnd2: 'text'}" sortable="'fnd2'">{{fondo.fnd2}}</td> 
      <td class="i9font text-center" data-title="'Bucket DH'" header-class="'i9header'" filter="{bktDH: 'text'}" >{{fondo.bktDH}}</td> 
      <td class="i9font text-center" data-title="'Fondo DH bucket 1'" header-class="'i9header'" filter="{fnd1DH: 'text'}" >{{fondo.fnd1DH}}</td> 
      <td class="i9font text-center" data-title="'Fondo DH bucket 2'" header-class="'i9header'" filter="{fnd2DH: 'text'}" >{{fondo.fnd2DH}}</td> 
      <td class="i9font text-center" data-title="'Rapporto'" header-class="'i9header'" filter="{rapporto: 'text'}" sortable="'rapporto'">{{fondo.rapporto}}</td> 
      <td class="i9font text-center" data-title="'Cdg'" header-class="'i9header'" filter="{cdg: 'text'}" sortable="'cdg'">{{fondo.cdg}}</td> 
      <td class="i9font text-center" data-title="'Matricola ins'" header-class="'i9header'" filter="{insMatr: 'text'}" sortable="'insMatr'">{{fondo.insMatr}}</td> 
     </tr> 
    </table> 

我想選擇從該表中只有一行上有一個簡單的點擊,而此行,不僅是我在表格中顯示的那些的數據顯示,而且別人提到我的選擇行。簡而言之,我需要單擊一行來顯示該選擇的詳細信息。 我該怎麼辦?

回答

0

可以綁定納克單擊錶行一樣,

<tr ng-repeat="fondo in data | filter:getChiave | filter:getRapporto" ng-click="processData(fondo)"> 
</tr> 

所以每行的點擊你會得到控制相應的數據。

.controller('myCntrl',function($scope){ 
      $scope.processData=function(data){ 
       console.log(data) 
      } 

     }); 
+0

它的工作原理!非常感謝你!這是我需要的。 – Lorenzo

相關問題