2015-04-02 47 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