Found a solution.
In the controller, after grid creation:
# Sort grid's search fields list.
grid.element('#w2p_query_fields').components =
sort_grid_search_fields_list(grid)
In a modules file
def sort_grid_search_fields_list(grid):
# type: (grid: gluon.DIV) -> List[gluon.OPTION]
"""Sort grid's search fields list.
:param grid: Grid.
:return: Sorted search fields list (HTML options).
"""
keys = [] # type: List[str]
elements = {} # type: Dict[str, str]
for element in grid.element('#w2p_query_fields').components: # type:
gluon.OPTION
keys.append(element.flatten())
elements[element.flatten()] = element['_value']
keys.sort(key=str.lower)
return [gluon.OPTION(key, _value=elements[key]) for key in keys]
quarta-feira, 13 de Março de 2019 às 10:16:11 UTC, Leonel Câmara escreveu:
>
> No, not right now it isn't. What's possible is to make your own
> search_widget which could do the sorting of the search fields.
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.