智能表插件不起作用

时间:2015-04-02 14:47:59

标签: angularjs smart-table

这是我的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);

它没有显示任何错误。 我检查了智能表文档,看看我是否标记错误,但似乎一切正常。我不知道现在该做什么。

可能会发生什么?

感谢。

1 个答案:

答案 0 :(得分: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