Permalink
Browse files

Fix initial sorting of game results table.

  • Loading branch information...
1 parent f1b78ca commit f44a2664f0b5b995c5f2b3a627f731812f519ab4 @danieldickison danieldickison committed Sep 6, 2011
Showing with 11 additions and 10 deletions.
  1. +11 −10 src/TestHarness/clientjs/instructor.js
@@ -77,21 +77,21 @@ $(document).ready(function ()
// Table data
+ function fieldComparator(field)
+ {
+ return function (item1, item2)
+ {
+ return util.compare(item1[field], item2[field]);
+ };
+ }
+
function connectGridToDataView(grid, dataView)
{
grid.onSort.subscribe(function (e, args)
{
var sortAsc = args.sortAsc,
- sortCol = args.sortCol,
- field = sortCol.field;
-
- var sortFun = function (item1, item2)
- {
- var a = item1[field],
- b = item2[field];
- return util.compare(a, b);
- };
- dataView.sort(sortFun, sortAsc);
+ field = args.sortCol.field;
+ dataView.sort(fieldComparator(field), sortAsc);
});
dataView.onRowCountChanged.subscribe(function (e, args)
{
@@ -175,6 +175,7 @@ $(document).ready(function ()
return (selectedStudentLoginIDs.length == 0 ||
~selectedStudentLoginIDs.indexOf(item.loginID));
});
+ gamesDataView.sort(fieldComparator('endTime'), false);
gamesGrid.setSortColumn('endTime', false);
gamesGrid.setSelectionModel(new Slick.RowSelectionModel());
gamesGrid.onSelectedRowsChanged.subscribe(function ()

0 comments on commit f44a266

Please sign in to comment.