Whilst trying to understand how the `criteria` functionality of the datatables wrapper works, I discovered that is only works at the options level (i.e all searchable fields have the same match criteria applied). We should be able to set the match criteria at the column level, for example you may want 'exact' match for fields that contain AV codes, or 'starts_with' one field and 'contains' for another.
Created attachment 126673 [details] [review] Bug 29302: Allow passing of 'criteria' at the column level This patch adds the option to pass 'criteria' at the 'column' definition level which means you can set 'contains', 'starts_with', 'ends_with' and 'exact' match types for each different column.
I ended up needing something a bit more than this in my own bug (I want 'before' and 'after' date support).. but I wanted to post the basics here as a starting point.
I'm tempted to rename the key too.. 'criteria' isn't hugely clear and it took me reading the code to figure out. Perhaps 'comparator or 'comparison_operator' would more clearly reflect its function?
Created attachment 127358 [details] [review] Bug 29302: Allow passing of 'criteria' at the column level This patch adds the option to pass 'criteria' at the 'column' definition level which means you can set 'contains', 'starts_with', 'ends_with' and 'exact' match types for each different column.
This is a little naive in its approach. Whilst I still think it would be useful to be able to specify the match type per column, I think we need to distinguish between 'search' and 'filter' operations. When executing a 'search', it makes sense to perform 'contains', 'starts_with' type searches.. but for a 'filter' (i.e. at the individual column level) you might have a select like and want to do an 'exact' type match. As such, I think we need to be able to specify more granularly still.
Created attachment 137695 [details] [review] Bug 29302: Allow passing of 'criteria' at the column level This patch adds the option to pass 'criteria' at the 'column' definition level which means you can set 'contains', 'starts_with', 'ends_with' and 'exact' match types for each different column.