delphic++builderfiremonkeyfiredaclivebindings

Radstudio ListView and FireDac Binding Synch Issue


I have a table with a primary key (ID) and a unique field (REF) that I want to bind to a ListView.

With LiveBindings the links are created with :

1) (Table) * <-> Synch (ListView)

2) (Table) ref -> Item.Text (ListView)

Additionaly, a link are created with other component:

3) (Table) ref -> Text (ListBoxItem1)

ALL WORKS FINE if IndexFieldNames of Table are ID.

But I want to sort records by REF and when I set IndexFieldNames = ref the selected table record is always the PREVIOUS selected item on ListView, this means:

At same time that the selected ListView.Item.Text = "Ref of Record no. 2" the ListBoxItem1.Text = "Ref of Record no. 1".

I'm new with live bindings, did I make some mistake?


Solution

  • I only get a workaround:

    1) Do NOT connect synch of listview;

    2) IndexFieldNames = ref

    3) Inside event OnClick (ListView) use a Table.Locate to set the correct clicked record.