Skip to content

Commit

Permalink
close #16 ソートの不具合を解決
Browse files Browse the repository at this point in the history
  • Loading branch information
8398a7 committed Feb 13, 2015
1 parent 332117e commit 78fae58
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
11 changes: 11 additions & 0 deletions app/assets/javascripts/recommends.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$.extend $.fn.DataTable.ext.oSort,
'custom': (a) ->
a
'custom-asc': (x, y) ->
x = parseFloat(x)
y = parseFloat(y)
if x < y then -1 else if x > y then 1 else 0
'custom-desc': (x, y) ->
x = parseFloat(x)
y = parseFloat(y)
if x < y then 1 else if x > y then -1 else 0
3 changes: 2 additions & 1 deletion app/views/recommends/integration.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ javascript:
(function() {
$('.table').dataTable({
order: [1, 'desc'],
aLengthMenu: [#{ @sheets.count }]
aLengthMenu: [#{ @sheets.count }],
columnDefs: [{type: 'custom', targets: [1]}]
});
}).call(this);
6 changes: 4 additions & 2 deletions app/views/recommends/list.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ table.table
td.center bgcolor=@color[0] = val[4]
td.center = val[5]
javascript:
(function() {
$(document).ready(function() {
$('.table').dataTable({
aLengthMenu: [#{ @sheets.count }]
order: [4, 'desc'],
aLengthMenu: [#{ @sheets.count }],
columnDefs: [{type: 'custom', targets: [1, 2, 3, 4, 5, 6]}]
});
}).call(this);
3 changes: 2 additions & 1 deletion app/views/sheets/power.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ table.table
javascript:
(function() {
$('.table').dataTable({
aLengthMenu: [#{ @sheets.count }]
aLengthMenu: [#{ @sheets.count }],
columnDefs: [{type: 'custom', targets: [1, 2, 3, 4, 5, 6]}]
});
}).call(this);

0 comments on commit 78fae58

Please sign in to comment.