pivotal-energy-solutions / django-datatable-view

Server-side datatable representations for Django querysets for automatic rendering in templates
Apache License 2.0
347 stars 141 forks source link

search_fields Meta option ignoring items except the last #213

Open doganmeh opened 6 years ago

doganmeh commented 6 years ago

Title says it all.

Minorias commented 4 years ago

While investigating this behaviour I found what it is caused by. https://github.com/pivotal-energy-solutions/django-datatable-view/blob/c1466a67cb9c90889c8a5b299d50910458bcdf18/datatableview/datatables.py#L684

Since all the search_fields are put into the dictionary with the key "None", they overwrite each other leaving only the last one that is inserted.

execthis commented 4 years ago

We had the same issue - replacing None with a unique key like column.sources[0] fixes it:

searches[term].update({column.sources[0]: column for column in self.config['search_fields']})

lhoncorty commented 4 years ago

The fix is good. @execthis . Cool, man.