From 691cb027a5c9fac6f78a3c82da06c476d240954e Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 28 Oct 2016 11:12:29 +0200 Subject: JQueryJqGrid by default sorting is made using ordering in meta --- ishtar_common/widgets.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'ishtar_common/widgets.py') diff --git a/ishtar_common/widgets.py b/ishtar_common/widgets.py index 9e656311b..d3a2c975e 100644 --- a/ishtar_common/widgets.py +++ b/ishtar_common/widgets.py @@ -516,10 +516,29 @@ class JQueryJqGrid(forms.RadioSelect): def __init__(self, source, form, associated_model, attrs={}, table_cols='TABLE_COLS', multiple=False, multiple_cols=[2], new=False, new_message="", source_full=None, - multiple_select=False): + multiple_select=False, sortname="__default__"): + """ + JQueryJqGrid widget init. + + :param source: url to get the item from -- get_item + :param form: + :param associated_model: model of the listed items + :param attrs: + :param table_cols: + :param multiple: + :param multiple_cols: + :param new: + :param new_message: + :param source_full: url to get full listing + :param multiple_select: + :param sortname: column name (model attribute) to use to sort + """ + super(JQueryJqGrid, self).__init__(attrs=attrs) self.source = source self.form = form - self.attrs = attrs + if not attrs: + attrs = {} + self.attrs = attrs.copy() self.associated_model = associated_model self.table_cols = table_cols self.multiple = multiple @@ -527,6 +546,7 @@ class JQueryJqGrid(forms.RadioSelect): self.multiple_cols = multiple_cols self.new, self.new_message = new, new_message self.source_full = source_full + self.sortname = sortname def get_cols(self, python=False): jq_col_names, extra_cols = [], [] -- cgit v1.2.3