2015-04-02 49 views
1

這是我的HTML:智能表插件不工作

<table st-table="prizesByCompany" st-safe-src='safePrizesByCompany' class="table table-striped" > 
    <thead> 
     <tr> 
      <th st-sort='status'>Filtros</th> 
      <th st-sort='text'>Campanha</th> 
      <th> 
       <button class="btn" ui-sref='campaignAdd'>Nova Campanha</button> 
      </th> 
     </tr> 
     <tr> 
      <th colspan="3"><input st-search="text" class="form-control" placeholder="Pesquise..." type="text"/></th> 
     </tr> 
    </thead> 
    <tbody> 

     <tr ng-repeat="row in prizesByCompany"> 
      <span ng-if="row.status != 1"> 
       <td> 
        <button class="btn" >{{row.status | company_status_button}}</button> 
       </td> 
       <td><a ui-sref = 'campaignView({action: "view", id:{{row.id}}})'>{{row.text}}</a></td> 
       <td> 
        <div ng-if='row.status == 2'> 
         <button class='btn' ui-sref='campaignEditRequest({id: {{row.id}}})'>Editar</button> 
         <button class='btn'>Solicitar Pausa </button> 
         <button class='btn' ng-click='deactivateCampaign($index)'>Solicitar Cancelamento</button> 
         <button class='btn'>Relatório</button> 
        </div> 
        <div ng-if='row.status == 3'> 
         <button class='btn' ng-click='activateCampaign($index)'>Solicitar Reativação</button> 
         <button class='btn'>Relatório</button> 
        </div> 
        <div ng-if='row.status == 1'> 
         <button class='btn' ng-click='activateCampaign($index)'>Solicitar Reativação</button> 
         <button class='btn'>Relatório</button> 
        </div> 
       </td> 

      </span> 
     </tr> 
    </tbody> 
</table> 

表顯示正常,但插件不工作。

關於集合:

   $scope.prizesByCompany = data.response 
       $scope.safePrizesByCompany = angular.copy($scope.prizesByCompany); 

它不顯示任何錯誤。 我檢查了智能表文檔,看看我是否在標記錯誤,但它似乎是一切正常。我不知道現在該做什麼。

會發生什麼?

謝謝。

回答

0

我認爲,這是由於st-safe-src在表標記(而不是str-safe-src)中的錯字。你應該也寫屬性值用雙引號

<th st-sort="status">Filtros</th> 
<th st-sort="text">Campanha</th> 

此外,你應該使用相同的標記爲您的集合:

$scope.safePrizesByCompany = data.respsonse 
$scope.prizesByCompany = [].concat($scope.safePrizesByCompany) // actually you don't even need this line and can simply remove it 
+0

其實這是'ST-安全-src':HTTP:// lorenzofox3。 github.io/smart-table-website/ – 2015-04-06 12:56:54

+0

是的,但在你提供的示例中,你寫了str-safe-src;) – laurent 2015-04-07 02:02:06

+0

大聲笑你說得對。抱歉。但不幸的是,這不是問題。如果只是一個錯字,我會很高興。 – 2015-04-07 14:04:13