HideRow(x) and filtered grid

Good afternoon Bruno,

it's possible hide some rows while the grid is already filterd ?



If yes, i've some problem; to reproduce the problem (if it is) try:

- Populate the grid whith some any value

- in a button click



begin

SG1.FilterActive:=False;

SG1.Filter.Clear;

with SG1.Filter.Add do

begin

    Column:=2; // is store a quantity (integer) value     

    Condition:='> 0';

end;

SG1.FilterActive:=True;

// Now is the grid is filtered .... try to from last to first

for I:=sg1.LastRow downto 1 do

begin

    if SG1.Ints[2,I]>'5' then

    begin

        SG1.RowColor:=clMoneyGreen; // for color test

        SG1.HideRow(I); // try to hide

     end

     else

     SG1.RowColor:=clWhite;

end;

End;



What append to me is that all rows with a value, in colum 2, greater than 5 are colored with clmoneygreen but are not hidden.



rounding in the code of the hiderows procedure, while the grid is filtered, is executed this part of the code.



if c = ToRow - FromRow + 1 then

begin

    rlist.Free;

    Exit; <-------------

end;



If i try to hide only one row, C will always be 1 because ToRow - FromRow is 0 (of course .... while the grid is filtered).

If the grid is not filterd, the code is execute well and the rows that match the condition will be hide.



If No, sorry for this post.



Have a nice weekend



Daniele

Row hiding & filtering are mutually exclusive features. Filtering already internally uses row hiding to remove filtered rows, so combining this with other row hiding is not supported. If for some reason you need to hide rows in an already filtered grid, you can consider to use the pseudo row hiding by using grid.SuppressRow().

Thank's bruno,

whit SuppressRow i solve the situation.



Thank's again



Daniele