ListView Filter not working after fetching data from datasnap server


I have an application made in Delphi Seattle, and i migrated to Delphi Tokyo. But my searches in ListView are no longer working properly.
On a first use, it works correctly, i filter a record and edit it. I send the data to a datasnap server and fetch all records again to refresh the listview. But if I try to search again, it no longer finds the record, however browsing the listview I can find the record.

Apparently all records that are not appearing on the screen when I reload the data are not being filtered. If I manually navigate to the record and perform the search, then it works.

My Code to retrieve data from datasnap and show on listview:

DadosSocio := F_ClientModule.ServerMethods1Client.GetSocio(0);
Assert(TFDJSONDataSetsReader.GetListCount(DadosSocio) = 1);

mem_Socios.AppendData(TFDJSONDataSetsReader.GetListValue(DadosSocio, 0));

lvSocios.ScrollViewPos := 0;

I use this code to clean the filter:

for I := 0 to lvSocios.Controls.Count-1 do
if lvSocios.Controls[I].ClassType = TSearchBox then
TSearchBox(lvSocios.Controls[I]).Text := ”;

I tried to use this code to clean the filter, but it returns the error Argument out of Range:

lvSocios.Items.Filter := nil;

Comments are closed.