diff --git a/App/StackExchange.DataExplorer/Content/slickgrid/images/sort-asc.gif b/App/StackExchange.DataExplorer/Content/slickgrid/images/sort-asc.gif
new file mode 100644
index 00000000..67a2a4c6
Binary files /dev/null and b/App/StackExchange.DataExplorer/Content/slickgrid/images/sort-asc.gif differ
diff --git a/App/StackExchange.DataExplorer/Content/slickgrid/images/sort-desc.gif b/App/StackExchange.DataExplorer/Content/slickgrid/images/sort-desc.gif
new file mode 100644
index 00000000..34db47c3
Binary files /dev/null and b/App/StackExchange.DataExplorer/Content/slickgrid/images/sort-desc.gif differ
diff --git a/App/StackExchange.DataExplorer/Scripts/query.js b/App/StackExchange.DataExplorer/Scripts/query.js
index 36dc9e5e..959d3c74 100644
--- a/App/StackExchange.DataExplorer/Scripts/query.js
+++ b/App/StackExchange.DataExplorer/Scripts/query.js
@@ -880,7 +880,8 @@ DataExplorer.ready(function () {
'name': columns[i].name,
'field': "col" + i,
'type': columns[i].type.toLowerCase(),
- 'width': Math.min((widths[i] || 50) + 16, maxWidth)
+ 'width': Math.min((widths[i] || 50) + 16, maxWidth),
+ 'sortable': rows.length <= 5000
};
if (name === 'tags' || name === 'tagname') {
@@ -898,6 +899,15 @@ DataExplorer.ready(function () {
grid = new Slick.Grid(target, rows, columns, options);
grid.onColumnsResized.subscribe(resizeResults);
+ grid.onSort.subscribe(function (e, args) {
+ var field = args.sortCol.field;
+
+ args.grid.getData().sort(function (lhs, rhs) {
+ return (args.sortAsc ? 1 : -1) * (lhs[field] == rhs[field] ? 0 : lhs[field] < rhs[field] ? -1 : 1);
+ });
+
+ args.grid.invalidate();
+ });
}
function ColumnFormatter(response) {
diff --git a/App/StackExchange.DataExplorer/StackExchange.DataExplorer.csproj b/App/StackExchange.DataExplorer/StackExchange.DataExplorer.csproj
index f16c2302..50874779 100644
--- a/App/StackExchange.DataExplorer/StackExchange.DataExplorer.csproj
+++ b/App/StackExchange.DataExplorer/StackExchange.DataExplorer.csproj
@@ -267,6 +267,8 @@
+
+