Fix: Log Grid will now allow sorting by multiple columns.

pull/19/head
Mark McDowall 13 years ago
parent b86a19451d
commit 5d81c6b7b1

@ -64,11 +64,16 @@ namespace NzbDrone.Web.Controllers
int filteredCount = q.Count();
int sortCol = dataTablesParams.iSortCol.First();
var sortColName = sortCol == 0 ? "Time" : sortCol == 1 ? "Level" : "Logger";
var sortExpression = String.Format("{0} {1}", sortColName, dataTablesParams.sSortDir.First());
IQueryable<Log> sorted = q;
var sorted = q.OrderBy(sortExpression);
for (int i = 0; i < dataTablesParams.iSortingCols; i++)
{
int sortCol = dataTablesParams.iSortCol[i];
var sortColName = sortCol == 0 ? "Time" : sortCol == 1 ? "Level" : "Logger";
var sortExpression = String.Format("{0} {1}", sortColName, dataTablesParams.sSortDir[i]);
sorted = sorted.OrderBy(sortExpression);
}
IQueryable<Log> filteredAndSorted = sorted;
if (filteredCount > dataTablesParams.iDisplayLength)

@ -63,7 +63,7 @@
"sPaginationType": "four_button",
"aoColumns": [
{ sWidth: '150px', "mDataProp": "Time" }, //Time
{sWidth: '50px', "mDataProp": "Level" }, //Level
{sWidth: '60px', "mDataProp": "Level" }, //Level
{sWidth: '240px', "mDataProp": "Source" }, //Source
{sWidth: 'auto', "mDataProp": "Message", "bSortable": false }, //Message
{sWidth: 'auto', "mDataProp": "Details", "bSortable": false, "bVisible": false, "fnRender": function (row) {

Loading…
Cancel
Save