日期的顺序列表如何从对象获取
How order list of dates get from object
我有一个按日期排序的列表,我想通过单击按钮对其进行重新排序。这个日期取自一个对象,我尝试了这段代码,但它的排序就像一个简单的数字:
// function to order and change button by click
$scope.sortType = "CreationDate";
$scope.sortReverse = false;
$scope.buttonStyle = "icon ion-ios-time-outline";
$scope.buttonPress = false;
$scope.ordina = function() {
if ($scope.sortType == "CreationDate") {
$scope.sortReverse = !$scope.sortReverse;
console.log("riordinate");
}
$scope.buttonPress = !$scope.buttonPress;
if ($scope.buttonPress == true) {
$scope.buttonStyle = "icon ion-ios-time";
} else {
$scope.buttonStyle = "icon ion-ios-time-outline";
}
}
在 HTML 中:
<ion-item ng-repeat="object in allODA | filter: searchQuery | orderBy : sortType : sortReverse " href="#/app/ODA_Detail/{{object.caseTaskId}}">
任何解决方案???想法???
我不知道
我是否正确理解,但这里有一个使用日期对表格进行排序的示例,单击列的标题对其进行排序。
https://jsfiddle.net/lisapfisterer/8pvqau4z/
这不使用离子,您可能需要对其进行调整。
<table class="table table-striped">
<thead>
<td data-ng-click="sortType = name; sortReverse = !sortReverse;">
Date
</td>
<td data-ng-click="sortType = name; sortReverse = !sortReverse;">
Name
</td>
</thead>
<tbody>
<tr ng-repeat="item in allItems | orderBy:sortType:sortReverse">
<td>{{item.date | date:"yyyy-MM-dd"}}</td>
<td>{{item.name}}</td>
</tr>
</tbody>
</table>
相关文章:
- 在node.js中使用JavaScript从JSON对象获取和设置文本内容
- 如何在JavaScript中基于事件对象获取文件名
- 使用Lodash从JSON对象获取特定于环境的配置
- 从每个父对象获取attr,并为每个子对象设置attr
- 使用javascript从json对象获取父名称
- 从express请求对象获取客户端MAC地址
- 正在从JSON对象获取数组
- 使用生成的键从对象获取数据
- 如何在 C# 中从 JavaScript 对象获取值
- JavaScript |对象:获取属性忍者移动
- 从 CasperJS 中的嵌套 JavaScript 对象获取值
- 从 JSON 对象获取数据时出现问题
- Angularjs 从范围对象获取值
- 以点表示法计算字符串,以从视图中的对象获取相应的值
- 如何测试从promise对象获取数据的控制器
- Javascript-在for循环上从var中的对象获取适当性
- 在javascript中从json对象获取数据
- 如何从每个对象获取jQuery的“title”和“url”值
- 从react routers browserHistory对象获取当前页面路径
- 从Javascript对象获取CSV值