Hi to all,
i have a normal AdvStringGrid and, in order to show all the present items, i set a filter as
with SG1.Filter.Add do
begin
Column:=2;
Condition:='> 0';
end;
SG1.FilterActive:=True;
and the grid is filtered.
In the form exist an AdvEdti where the onchange event is
SG1.NarrowDown(Edt1.Text,4);
where in column 4 is stored the manufacturer.
Now if the grid is not filterd the NarrowDown works well, but if the grid is filtered when the instruction SG1.NarrowDown(Edt1.Text,4) is executed, the grid loos the filter condition.
Is possible use the NarrowDown when the grid is already filtered ?
Thank's for your attention and reply.
Regards
Daniele
Hi to all,
i have navigate to the narrowdown procedure and i have found where the code could be change.
Here the part of code
......
if not isincr then
begin
RemoveAllFilters; // ** Here the problem ....
if (ACondition <> '') then
begin
Filter.Clear; // .... and here .....
with Filter.Add do
begin
......
I think that is possible to make this changes
if not isincr then
begin
// check if the grid is already filtered
If FilterActive Then
begin
// Check if the last filter war narrowdown
If LastFilterWasNarrowDown Then
begin
// Remove last filter and prepare to get the new one keep the other
End
else
begin
// No, the last filter is not narrowdown, search if in the filter collection there's a narrowdown filter, In filter collection new property IsNarrowDown : Boolean
For I:=Filter.Count - 1 DownTo 0 do
begin
If Filter.IsNarrowDow then
begin
// Ok, find a narrowdown filter ... delete it an continue
// If no more found ... keep the other
end;
end;
end;
end
else
RemoveAllFilters;
continue withe the origina code .....
Not easy to do, but the next version can be a very super complete filter grid.
Thank's for your attention
Regards
Daniele
We'll need to investigate this deeply to see if there aren't any possible side effects of this approach.When feasible, we'll integrate this.