Hi,
I'm trying django-ajax-datatable for the first time and I'm struggling with Filtering single columns, the filters do not display
here is my view :
`class VacationAjaxDatatableView(AjaxDatatableView):
model = DemandeConge
title = 'Mes demandes de congé'
search_values_separator = '+'
show_column_filters = True
full_row_select = False
initial_order = [["type_conge", "asc"], ]
column_defs = [
# AjaxDatatableView.render_row_tools_column_def(),
{
'name': 'type_conge', # required
'title': 'Type congé', # optional: default = field verbose_name or column name
# 'choices': False, # see `Filtering single columns` below
# 'initialSearchValue': None, # see `Filtering single columns` below
# 'autofilter': False, # see `Filtering single columns` below
# 'boolean': False, # treat calculated column as BooleanField
# 'lookup_field': '__icontains',
'searchable': True,
'visible': True,
# used for searches; default: '__iexact' for columns with choices, '__icontains' in all other cases
}
, {
'name': 'start_date', # required
'title': 'Date début', # optional: default = field verbose_name or column name
# 'placeholder': False, # ???
# 'choices': None, # see `Filtering single columns` below
# 'initialSearchValue': None, # see `Filtering single columns` below
# 'autofilter': False, # see `Filtering single columns` below
# 'boolean': False, # treat calculated column as BooleanField
'lookup_field': '__icontains',
'searchable': True
},
{
'name': 'end_date', # required
'title': 'Date fin', # optional: default = field verbose_name or column name
# 'placeholder': False, # ???
# 'choices': None, # see `Filtering single columns` below
# 'initialSearchValue': None, # see `Filtering single columns` below
# 'autofilter': False, # see `Filtering single columns` below
# 'boolean': False, # treat calculated column as BooleanField
'lookup_field': '__icontains',
'searchable': True
},
]
def get_initial_queryset(self, request=None):
user = self.request.user
if not self.request.user.is_authenticated:
raise PermissionDenied
queryset = DemandeConge.objects.filter(employe=user.userprofile).all()
return queryset`
Hi, I'm trying django-ajax-datatable for the first time and I'm struggling with Filtering single columns, the filters do not display
here is my view : `class VacationAjaxDatatableView(AjaxDatatableView): model = DemandeConge title = 'Mes demandes de congé' search_values_separator = '+' show_column_filters = True full_row_select = False initial_order = [["type_conge", "asc"], ]
thanks for your help