Column filtering through the columns' Filter
stringlist property is not working.
Debugging the grid's OnFilterSelect
event I noticed that FilterCondition
had always the same value of FriendlyName
.
Looking deeper I ended on FilterSelect
procedure of AdvCGrid.pas
. It makes a call to a GetFilter
function, that loads all column filters to the FilterList
property. This property ends with all filter display names, but not the filter conditions, so, 4 lines ahead when it checks for the existence of a filter condition (AdvCGrid.pas
, line 2009: [ if Pos('=',F) > 0 then
] ) , it'll always be false .
I solved it by replacing the use of the FilterList
property directly by the column Filter
StringList property:
// F := FilterList.Strings[ItemIndex]; { Original code }
F := FColumnCollection.Items[FilterColumn].Filter.Strings[ItemIndex]; {new code }
Could you please verify that?
To reproduce this you can use acg1.dpr
, then try to apply any of the filters, such as BMW Only . You'll see the OnFilterSelect
will fire with FriendlyName = 'BMW Only'
and FilterCondition = 'BMW Only'
.