QDatagrid GetFilters restricition

Login or register to post comments
2 replies [Last post]
kon
Offline
Joined: 12/08/2009

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?

Offline
Joined: 03/31/2008

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.

kon
Offline
Joined: 12/08/2009

Ah, I used only one value (the one from the dropdown) in my AndCondition, the other values were coming from somewhere else.