1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-26 17:59:14 +00:00

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

This commit is contained in:
Mark McDowall 2012-02-25 15:14:48 -08:00
parent b86a19451d
commit 5d81c6b7b1
2 changed files with 10 additions and 5 deletions

View file

@ -64,11 +64,16 @@ public ActionResult AjaxBinding(DataTablesParams dataTablesParams)
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)

View file

@ -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) {