Sort selectize when rendered

This commit is contained in:
JonnyWong16 2018-01-13 17:46:46 -08:00
parent 2b22f8eb4f
commit 515e6a8071
2 changed files with 5 additions and 8 deletions

View file

@ -109,14 +109,14 @@
% if isinstance(item['select_options'], dict):
% for section, options in item['select_options'].iteritems():
<optgroup label="${section}">
% for option in options:
% for option in sorted(options, key=lambda x: x['text'].lower()):
<option value="${option['value']}">${option['text']}</option>
% endfor
</optgroup>
% endfor
% else:
<option value="border-all"></option>
% for option in item['select_options']:
% for option in sorted(item['select_options'], key=lambda x: x['text'].lower()):
<option value="${option['value']}">${option['text']}</option>
% endfor
% endif