QDatagrid GetFilters restricition
Wed, 04/13/2011 - 08:30
Hey
I came across an error while I tried to use custom datagrid filters with the datagrid column's FilterAddListItem(string, QQCondition) method.
The exception was that it expected a QQConditionComparison whereas I used multiple QQConditionComparisons wrapped in a QQConditionLogical.
So in the QDatagridBase class in the method GetFilters I changed
<?php
if($col->Filter instanceof QQConditionComparison)
{
$filters[$col->Name] = $col->Filter;
}
?>to
<?php
if($col->Filter instanceof QQConditionComparison
|| $col->Filter instanceof QQConditionLogical)
{
$filters[$col->Name] = $col->Filter;
}
?>to see if it works.
It worked correctly and now my question is was that just missed (i.e. should I open a ticket) or is there another reason behind this that I am missing?

The filters have to know where to insert the user's input, which they can't do with a Logical condition. So even though your set/restore may work, the actual filter probably will crash when trying to use it.
Ah, I used only one value (the one from the dropdown) in my AndCondition, the other values were coming from somewhere else.