get_datatable pass parameter
samusa123 opened this issue · 1 comments
I use EmbeddedTableDatatableView. But how can I pass parameter dynamically to the datatable.
In the following example code,
context['datatable'] = SatelliteDatatableView().get_datatable()
I do not see any way of passing a dynamic variable so I can run a query filter.
for example, if I have an id in EmbeddedTableDatatableView, I would like to pass id to SatelliteDatatableView so it can be used in get_queryset in DatatableView
context['datatable'] = SatelliteDatatableView().get_datatable(id)
Thanks for the great work.
Let me answer my question. This is figured out.
I declare a class variable id in SatelliteDatatableView.
temp = SatelliteDatatableView()
SatelliteDatatableView.id = 123
context['datatable'] = temp.get_datatable()
id variable is static and it can be used in get_query_set.
Hope this helps someone.