GetCheckBoxState returns only for displayed rows!?

If I have for example 100 rows in DBAdvGrid but grid's height shows only 10 records. GetCheckBoxState( Coll, br, status )  returns result only for visible 10 (howed) rows!

In my class helpper function I walk trough all rows in dbgrid and returning CSV of some ID's for all checked rows. Function returns right row count, but GetCheckBoxState( Coll, br, status ) returning status only for displayed records.

Anny sugestion?
This bug was discovered 3 months after placing my application in production mode of usage.

My class helper function:

function TITDBAdvGrid.ExportCheckedToCsv( const aFieldName,
  aCheckedFieldName: String ): String;
    br, br2, Coll: integer;
    List: TStringList;
    DS: TDataSet;
    status: Boolean;
    tmpBk: TBytes;

    List := TStringList.Create;
    List.Delimiter := ',';
    DS := Self.DataSource.DataSet;
      tmpBk := DS.GetBookmark;
      br2 := 0;
        Coll := Self.ColumnByName[ aCheckedFieldName ].Index;

        for br := 1 to Self.RowCount - 1 do

            if Self.GetCheckBoxState( Coll, br, status ) then

              if status then
                  DS.MoveBy( br - 1 - br2 );
                  List.Add( DS.FieldByName( aFieldName ).AsString );
                  br2 := br - 1;

        result := '';
      if DS.BookmarkValid( tmpBk )
        DS.GotoBookmark( tmpBk );
      DS.FreeBookmark( tmpBk );
      result := List.DelimitedText;



PageMode=False isn't option, I use dbgrids for navigating and editing recordset and advancend data fetching.

Did you have a look at the ADOSelection demo that shows how this type of functionality can be achieved (with PageMode = true)

Yes, I used principe from that demo, becouse multiselect isn't avaiable in PageMode=False (as You suggested in my earlier topic about multiselect).

As You can see in my first post, I used demo's working principe but in class helper function that improve my coding usability with TDbAdvGrid.

Problem is at point:  if Self.GetCheckBoxState( Coll, br, status ) then
For loop looping trough all range (Self.RowCount - 1) and this range is real (adequate to record count in dataset), but when br (record/row position) achieve currently last displayed row in grid on form GetCheckBoxState stop returning values.

My class function integrated into ADOSelection demo works ok. ADO replaced with IBDAC works ok, but bug occurs when is IBDAC reloaded with new data, for example after FilterSQL requering.
IBDAC fetchs all records at all and works ok. After filtering data (record count is still correct) dbgrid doesn't synchronize checkboxes with records and can't acces checkboxes even displayed.

I found how to reproduce this bug!
Please, open ADOSelection demo.
Add new button on form, and in buton's onclick event place:
ADOTable1.Filter := 'Cyl =4';
ADOTable1.Filtered := not ADOTable1.Filtered;

Try to check on last displayed 3 rows. Try to scroll grid - and all is OK.
Then, click to button (apply filter/change dataset's data), and try sane procedure (check on to 3 bottom displayed rows for example). Now try to scroll! cell colouring and checkboxes aren't synchronised with data. Try to check records from first to last displayed "in page" + n additional, and  click "show selection". In selection are displayed only rows from "fisrt page".

Can You please invastigate nad solve this bug. This behaviour is very important part of my own framework for business applications.

Can you try to set DBAdvGrid.DataSetType = dtNonSequenced

Yes, with no difference. Simplest way to reproduce bug is filtering Ado
dataset from ADOSelection demo as is shown in my post. I coudn't find
any property or property set that eliminate wrong checkbox painting and restricting on displayed rows.

As I suspected, dataset filtering make grid crazy.

In  procedure TDBAdvGrid.DataChange;

 if FFilteredDataSet <> FDataLink.DataSet.Filtered then
    if FDataLink.DataSet.Filtered then
      if (DataSetType = dtSequenced) then
        FOldDataSetType:= DataSetType;
        DataSetType:= dtNonSequenced;
    else //not FDataLink.DataSet.Filtered then
      if (DataSetType <> FOldDataSetType) and (FOldDataSetType = dtSequenced) then
        DataSetType:= dtSequenced;

Even if DatasetTypeAuto := False and is selected DataSetType:= dtSequenced on filtering DataSetTyle goes to DataSetType:= dtNonSequenced and grid wrong paints, scroll, etc...

Even if IBDAC is Filter Sql does not use classic client filtering (It changes sql statement and Where, and requery new results from server) it's marked as filtered and TDBADVGrid goes crazy. ADO does local filtering on client and this is logical, but IBDAC (or other Devart components) in case of using FilterSQL fetching all new data from server but dataset is istill sequenced!

My temporary solution is putting DataSetType := dtSequenced in dataset's AfterOpen event.

Please review code in method TDBAdvGrid.DataChange.
I can't believe that any user wasn't have similar painting/scrolling problem on filtered data sets.