Additional parameters in returned Json
Issue #54
wontfix
Hi guys,
I am using Datatables with additional module called yadcf which provide some nice filtering to the table. My issue was to add additional parameters to returned Json. I fixed it by adding additional function:
def expand_returned_json(self,ret):
# here you may append additional parameters
return ret
def get_context_data(self, *args, **kwargs):
.
.
ret = {'draw': int(self._querydict.get('draw', 0)),
'recordsTotal': total_records,
'recordsFiltered': total_display_records,
'data': data
}
return self.expand_returned_json(ret)
except Exception as e:
return self.handle_exception(e)
Usage: def expand_returned_json(self, ret):
ret ['yadcf_data_0'] = ["KHTML","Webkit","Trident","Misc","Other browsers","Tasman","Presto","Gecko"]
return ret
Comments (2)
-
-
repo owner - changed status to wontfix
I think that the solution provided by @dwasyl is good enough. Just override get_context_data and use super()
- Log in to comment
In the past I've just overridden
get_context_data
and added filter values there to useyadcf
. As in: