Skip to content

Commit

Permalink
Repaired sorting of date columns
Browse files Browse the repository at this point in the history
  • Loading branch information
fgimian committed May 10, 2015
1 parent df3a797 commit fd351f4
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 9 deletions.
35 changes: 26 additions & 9 deletions puppetboard/static/coffeescript/tables.coffee
Original file line number Diff line number Diff line change
@@ -1,21 +1,38 @@
$ = jQuery
$ ->

$.tablesorter.addParser(
id: 'timestamp'

# Return false so this parser is not auto detected
is: (s) ->
false

# Normalize the timestamp to epoch for sorting
format: (s) ->
moment.utc(s).unix()

# The return value of our normalization function is an integer
type: 'numeric'
)

$('.nodes').tablesorter(
headers:
4:
sorter: false
sortList: [[1,0]]
headers:
2: sorter: 'timestamp'
3: sorter: 'timestamp'
4: sorter: false
sortList: [[1,0]]
)

$('.facts').tablesorter(
sortList: [[0,0]]
sortList: [[0,0]]
)

$('.dashboard').tablesorter(
headers:
3:
sorter: false
sortList: [[0, 1]]
headers:
2: sorter: 'timestamp'
3: sorter: false
sortList: [[0, 1]]
)

$('input.filter-table').parent('div').removeClass('hide')
Expand Down
20 changes: 20 additions & 0 deletions puppetboard/static/js/tables.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fd351f4

Please sign in to comment.