Show More
@@ -135,7 +135,8 b' class DataGridAppView(object):' | |||
|
135 | 135 | Common class to have re-usable grid rendering components |
|
136 | 136 | """ |
|
137 | 137 | |
|
138 | def _extract_ordering(self, request): | |
|
138 | def _extract_ordering(self, request, column_map=None): | |
|
139 | column_map = column_map or {} | |
|
139 | 140 | column_index = safe_int(request.GET.get('order[0][column]')) |
|
140 | 141 | order_dir = request.GET.get( |
|
141 | 142 | 'order[0][dir]', 'desc') |
@@ -143,10 +144,7 b' class DataGridAppView(object):' | |||
|
143 | 144 | 'columns[%s][data][sort]' % column_index, 'name_raw') |
|
144 | 145 | |
|
145 | 146 | # translate datatable to DB columns |
|
146 | order_by = { | |
|
147 | 'first_name': 'name', | |
|
148 | 'last_name': 'lastname', | |
|
149 | }.get(order_by) or order_by | |
|
147 | order_by = column_map.get(order_by) or order_by | |
|
150 | 148 | |
|
151 | 149 | search_q = request.GET.get('search[value]') |
|
152 | 150 | return search_q, order_by, order_dir |
General Comments 0
You need to be logged in to leave comments.
Login now