-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
44 lines (44 loc) · 863 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
function myController($scope) {
var scope = $scope;
$scope.items = {
result:{
values:[
{
item_id:0,
item_name:"item2",
item_detail:"second item"
},
{
item_id:1,
item_name:"item0",
item_detail:"third item"
},
{
item_id:2,
item_name:"item1",
item_detail:"first item"
}
],
fields:["item_id","item_name","item_detail"]
}
};
$scope.descending=false;
$scope.getOrder = function (column_name) {
var extra = '';
if (column_name == scope.items_order)
if (scope.descending)
extra = ' ↓';
else
extra = ' ↑';
return extra;
};
$scope.changeOrder = function (ev,column_name) {
if (column_name == scope.items_order) {
scope.descending = !scope.descending;
}
else {
scope.items_order = column_name;
scope.descending = false;
}
};
}