listviewdelphifiremonkeyfiredaclivebindings

How to call the refreshing of data-aware (live-binding) component in FireMonkey?


I have a TListView linked in LiveBindings with a TFDMemTable. I load data in the FDMemTable using LoadFromFile (I have for example 20 record).

When I delete a record from the FDMemTable, the RecordCount is decreased but the TListView is not refreshed, it continue to display the 20 records loaded on the LoadFormFile.

If, with the FDMemTable: I .SaveToFile, .Close, and reload with .LoadFromFile, the TListView now display the change.

This is the same behavior if I use the CachedUpdate of FDMemTable or not.

I've tried to call TFDMemTable.Refresh and TListView.Repaint without succes.

Is it possible to call the TListView to refresh his "linked" set of data ?

When I delete a record in the FDMemTable, why no visible refresh occur on the TListView ?

EDIT: I must add a thing, the record is deleted programmatically.

The desired functionality is to delete sone unwanted record in the FDMemTable and display the remaining record to the user with the TListView.


Solution

  • In LiveBindings Designer, by linking the Synch of the ListView to the * of the FDMemTable, the ListView now display the resulting record.

    LiveBindings Designer

    Also in my last algorithm, because I use .BeginBatch / .EndBatch (that disable data-aware refreshing), while processing data for removing unwanted record I've to disable the LiveBinding link temporarily (cause I use different sorting index whitin the processing of the data): LinkListControlToField1.Active := false; and "re-link" it after processing: LinkListControlToField1.Active := true;