Issues with a TTmsFmxGrid binded to a TObjectList

Hi,

I am using a TTmsFmxGrid binded to a TObjectList thanks to a TAdapterBindsource and its event OnCreateAdapter :

procedure TForm1.MyAdatperBindSourceCreateAdapter(Sender: TObject; var ABindSourceAdapter: TBindSourceAdapter);
begin
  FMyList:= TObjectList<TMyObject>.Create(False);
   ABindSourceAdapter:= TListBindSourceAdapter<TMyObject>.Create(Self, FMyList, False);
end;

When i am editing datas loaded in the grid, objects in the list or not modified.
I placed a basic TGrid on the same form and bind it to the same TAdapterBindsource, and when informations or modified 
in this grid, objects are modified to.

Firstly i was using custom editors in the TTmsFmxGrid, i removed them and i still have the problem.
Is there any property or event in the TTmsFmxGrid which needs to be set, in order to allow the objects to be update ?


thanks for your help.

Dear Mr. Vuillet, 


Currently, we only have support for Database bindings in the TTMSFMXGrid. Perhaps you could send us your sample to see which link is missing ?

Kind Regards, 
Pieter 
Thanks for your fast answer.

Here is a sample showing my issue (Delphi XE 5 update 2 project):

In a new HD desktop FireMonkey application, put on the form a TTmsFmxGrid and a TAdapterBindSource and bind them together (i also add a TGrid, and bind it to the same adapter in order to see differences in the two grids's behavior).

then you can add this code behind the form (I didn't modified the component's name, so you should be able to use this code withou changing it):

unit Unit1;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, Data.Bind.EngExt,
  Fmx.Bind.DBEngExt, FMX.TMSGridDataBinding, System.Rtti, System.Bindings.Outputs, Fmx.Bind.Editors,
  Data.Bind.Components, Data.Bind.Grid, Data.Bind.ObjectScope, FMX.TMSBaseControl, FMX.TMSGridCell,
  FMX.TMSGridOptions, FMX.TMSGridData, FMX.TMSCustomGrid, FMX.TMSGrid, FMX.Types, FMX.Controls,
  FMX.StdCtrls, System.Generics.Collections, Fmx.Bind.Grid, FMX.Layouts, FMX.Grid, FMX.Forms;

type

  TPerson = class
  private
    FName: string;
    FFirstName: string;
  public
    property Name: string read FName write FName;
    property FirstName: string read FFirstName write FFirstName;
    constructor Create(N, P: string);
  end;

  TForm1 = class(TForm)
    Panel1: TPanel;
    AdapterBindSource1: TAdapterBindSource;
    BindingsList1: TBindingsList;
    Grid1: TGrid;
    TMSFMXGrid1: TTMSFMXGrid;
    LinkGridToDataSourceAdapterBindSource12: TLinkGridToDataSource;
    LinkGridToDataSourceAdapterBindSource13: TLinkGridToDataSource;
    procedure AdapterBindSource1CreateAdapter(Sender: TObject;
      var ABindSourceAdapter: TBindSourceAdapter);
  private
    { Déclarations privées }
    FList: TObjectList<TPerson>;
  public
    { Déclarations publiques }
  end;

var
  Form1: TForm1;

implementation

{$R *.fmx}

procedure TForm1.AdapterBindSource1CreateAdapter(Sender: TObject;
  var ABindSourceAdapter: TBindSourceAdapter);
begin
  FList:= TObjectList<TPerson>.Create(False);
  with FList do
  begin
    Add(TPerson.Create('Dupond', 'Xavier'));
    Add(TPerson.Create('Rousseau', 'Herve'));
    Add(TPerson.Create('Henri', 'Jacques'));
  end;
  ABindSourceAdapter:= TListBindSourceAdapter<TPerson>.Create(Self, FList, False);
end;

{ TPerson }

constructor TPerson.Create(N, P: string);
begin
  inherited Create;
  FName:= N;
  FFirstName:= P;
end;

end.

Hi, 


We have investigated this here and have applied an improvement for this, the next version will address this. It will require the following code:

TMSFMXGrid1.Options.Editing.AutoPost := apCell and you will need to set FixedColumns to 0 at designtime.

Kind Regards, 
Pieter

Ok thanks.


I find a workound for this issue, using OnCellEditDone event to edit the objects in the list, until this version shows up.


Kind regards.