Search code examples
datatablesyadcf

Apply different group of filters to HTML column with yadcf (datatables)


I have a datatables column created in HTML (image) with this format:

<img src='[path to image]' class='[imgClass]'>

I've created a fiddle to see it in action.

Here is the conditions:

  • I have four images: black, green, yellow and red.
  • And I have two possible status: assigned/not assigned.
  • Black image belongs to not assigned status and green, yellow and red to assigned status.

To filter the images on column header, i search for the class and it works ok. But when i press ASSIGNED button on top(to get red, yellow and green ones), the filter doesn't work.


Solution

  • You were trying to do a multi select filtering while your filter type was a single select

    So you should set your yadcf filter to filter_type: 'multi_select', - see jsfiddle

    or even better use select2 with yadcf like this (select2 css/js should be added)

    filter_type: 'multi_select', select_type: 'select2',

    see jsfiddle