Module: check_mk
Branch: master
Commit: 324004bd25daff64f55127dfdf65efedfd78da1e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=324004bd25daff…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Oct 14 12:04:33 2011 +0200
FIX: fixed sorting of multiple joined columns in some cases
---
web/htdocs/views.py | 16 +++++-----------
1 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index cf8af93..0d470e4 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -2388,12 +2388,7 @@ def get_separated_sorters(view):
return group_sort, user_sort, view_sort
-def get_painter_join_index(view, painter):
- for e in view["painters"]:
- if e[0] == painter['name'] and len(e) >= 5:
- return e[3]
-
-def sort_url(view, painter):
+def sort_url(view, painter, join_index):
"""
The following sorters need to be handled in this order:
@@ -2408,9 +2403,6 @@ def sort_url(view, painter):
sorter = group_sort + user_sort + view_sort
- # When painter is joined, then add the join index as 3rd attribute to tuple
- join_index = get_painter_join_index(view, painter)
-
# Now apply the sorter of the current column:
# - Negate/Disable when at first position
# - Move to the first position when already in sorters
@@ -2451,9 +2443,11 @@ def sort_url(view, painter):
def paint_header(view, p):
painter = p[0]
+ join_index = None
if len(p) >= 4: # join column
if len(p) >= 5 and p[4]:
- t = p[4]
+ t = p[4]
+ join_index = p[3]
else:
t = p[3]
else:
@@ -2472,7 +2466,7 @@ def paint_header(view, p):
and view.get('user_sortable', True) \
and get_sorter_name_of_painter(painter) is not None:
params = [
- ('sort', sort_url(view, painter)),
+ ('sort', sort_url(view, painter, join_index)),
]
if html.has_var('_body_class'):
params.append(('_body_class', html.var('_body_class')))