Цитата: russko
Я добавляю проценты автоматом на событии <View>.Filter.OnChanged
Код: function AddPercents(ItemList: TcxFilterCriteriaItemList): string;
var
i: integer;
lItem: TcxFilterCriteriaItem;
s: string;
begin
for i := 0 to ItemList.Count - 1 do
begin
if ItemList.Items[i].IsItemList then
AddPercents(ItemList.Items[i] as TcxFilterCriteriaItemList)
else
begin
lItem := ItemList[i] as TcxFilterCriteriaItem;
if lItem.OperatorKind = foEqual then
begin
if lItem.ItemLink is TcxGridColumn then
begin
if TcxGridColumn(lItem.ItemLink).DataBinding.ValueTypeClass = TcxStringValueType then
lItem.OperatorKind := foLike;
end;
end;
if lItem.OperatorKind in [foLike, foNotLike] then
begin
s := Trim(VarToStr(lItem.Value));
if Length(s) > 0 then
begin
if s[1] <> '%' then s := '%' + s;
if s[Length(s)] <> '%' then s := s + '%';
end;
lItem.Value := s;
lItem.DisplayValue := s;
end;
end;
end;
end;