Hello, I have a simple form with a TTMSFMXTableView ( TableView1 ) and a TButton ( ButtonAddItem ), the TableView is filled in the OnCreate event of the form. After the form is shown, if I press the ButtonAddItem, a item is added to the TableView, but this item is not shown in the tableview. If I set the TableView BufferSize to 0 the application works, but if I leave it to its default value of 50, It does not work. For reproduce the bug, It is necesary to have the SelectedItemIndex to 0 for example.
I am using the lastest version of FMX UI Pack, 3.7.5.7 and Delphi 10.2 update 3.
I have attached to this topic the source code to reproduce the problem.
Once the first set of items are added, the buffer is set to the maximum number of items. So you have two choices. Either use the approach of setting a BufferSize of 0, which will then use all the items in the collection or reset the buffer with TMSFMXTableView1.LoadBufferBetween(-1, -1);
procedure TForm1.ButtonAddItemClick(Sender: TObject);
var
Item : TTMSFMXTableViewItem;
I : Integer;
begin
TableView1.BeginUpdate;
try
TableView1.LoadBufferBetween(-1, -1);
Item := TableView1.Items.Add;
I := TableView1.Items.Count - 1;
Item.Caption := 'Caption of item ' + IntToStr( I );
Item.Description := 'Description of item ' + IntToStr( I );
Item.Tag := I;
finally
TableView1.EndUpdate;
end;
end;
If this is the normal behaviour, you should to update the manual documentation doing reference to this issue. I do not understand why this is not done automatically by the component if you know that the problem exists.