【问题标题】:unable to filter the Date field in ngTable of angularjs无法过滤angularjs的ngTable中的日期字段
【发布时间】:2019-01-12 06:58:59
【问题描述】:

我正在处理 angularjs ngTable。我遇到了表格中日期字段过滤器的问题..

演示:http://plnkr.co/edit/LftGsnapD6QiZDewqz1P?p=preview

在表格过滤器中,输入 2018 时,表格中不会显示任何结果。我尝试将日期字段过滤为文本filter="{ orderDate: 'text'}",但没有成功。

样本:

  <table ng-table="tableParams" class="table" show-filter="true">
   <tbody ng-repeat="user in $data">
    <tr> 
    <td title="'Name'" filter="{ name: 'text'}" sortable="'name'">
    {{user.name}}</td>
    <td title="'Age'" filter="{ age: 'number'}" sortable="'age'">
    {{user.age}}  </td>
    <td title="'Order Date'" filter="{ orderDate: 'text'}" sortable="'orderDate'">
    {{user.orderDate | date:'yyyy-MM-dd HH:mm:ss'}} </td>
    </tr>
   </tbody>
  </table> 

【问题讨论】:

    标签: angularjs filter ngtable


    【解决方案1】:

    在模型中,您的 orderDate 是一个纪元(orderDate:1521836610848....)。它应该是格式为“yyyy-MM-dd HH:mm:ss”的日期或字符串。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多