加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angularjs – 智能表“st-sort”不工作

发布时间:2020-12-17 07:41:45 所属栏目:安全 来源:网络整理
导读:我使用角度v1.3.15.我通过点击api并将其通过范围传递到智能表,从而获取数据 这是在控制台上看到的“scope.rowCollection”的数据格式 数据填充好,但是当我试图点击表头并使用st-sort方法对它进行排序时,表值清楚地不排序列.这是我的html片段的视图 你能告诉
我使用角度v1.3.15.我通过点击api并将其通过范围传递到智能表,从而获取数据

这是在控制台上看到的“scope.rowCollection”的数据格式

数据填充好,但是当我试图点击表头并使用st-sort方法对它进行排序时,表值清楚地不排序列.这是我的html片段的视图

你能告诉我我正在做错什么当我使用我自己的数据收集集(不是硬编码)的时候,整个表值都是haywire.
我有一种感觉与我在角度端使用的变量名称有关.
任何帮助是非常感谢….谢谢

跟着你的评论Nikhil.这样使用st-safe-src:

HTML

<table st-table="displayedCollection" st-safe-src="rowCollection">
      <thead>
        <tr>
          <th st-sort="firstName">First Name</th>
          <th st-sort="lastName">Last Name</th>
        </tr>
      </thead>
      <tbody>
        <tr ng-repeat="row in displayedCollection">
          <td>{{row.firstName}}</td>
          <td>{{row.lastName}}</td>
        </tr>
      </tbody>
</table>

JS

app.controller('Ctrl',function($scope,service) {
    $scope.displayedCollection = [];

    service.all.then(function(list) {
        $scope.rowCollection = list;
        $scope.displayedCollection = list;
    });
});

而已.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读