I am using Delphi 10.3.1 (Firemonkey FMX) to build android and iOS app. I have a TListView, live binding with a AdapterBindSource. My problem is: new records does not appear after Adapter refreshed.
I created a TObjectList, added 3 objects to it
I created a TBindSourceAdapter by passing a TObjectList to create it.
I assign the TBindSourceAdapter to AdapterBindSource1.Adapter.
Then I Free the TObjectList and re-create it, add 4 newly created objects (3 of them are old records, with some data modified, 1 is a new record)
I do TBindSourceAdapter.Refresh and TAdapterBindSource.Refresh
Those 3 old records are refreshed successfully with modified data displayed, but the new record is not showing up in Android and iOS
The same logic working fine in Windows platform
first I get records from Rest Server and converted into a TObjectList
TData : class(TObject) … // a class stored some data
TDataList = class(TObjectList<TData>)
// then I get data from Rest Server and created FList, it is a Form private variable
FList := TDataList.Create; // a private Form variable
// create Tdata objects and add to FList …..
create TBindSourceAdapter, assign to AdapterBindSource
var ABindSourceAdapter: TBindSourceAdapter;
ABindSourceAdapter := TListBindSourceAdapter<TData>.Create(self, FList, True);
AdapterBindSource1.Adapter := ABindSourceAdapter;
AdapterBindSource1.Active := true;
then the records show on ListView which live bindings with the AdapterBindSource
Refresh FList records
When click on Refresh button, I trigger to get data from Rest server again, I do free the FList and re-create it
FList := TDataList.Create; // re-create the list, then create Tdata object and add to it again.
refresh the Adapter
then I refresh the adapter
here the 3 old records are refreshed successfully, modified data are displayed correctly, however, new record is not showing, the TListView still showing 3 records only.
I did not re-create TListBindSourceAdapter and assign to AdapterBindSource1.Adapter again during refresh, the records still refreshed successfully.
However, even I re-create TListBindSourceAdapter and assign to AdapterBindSource1.Adapter again, new record still does not show up, only caused memory leaking.
How can I resolve this? is there something I missing like to refresh the TListView? Or my BindSourceAdapter refresh logic is wrong?
Thanks for any help.