Why all datagrid like as follows are failing in iOS Simulator without any error message. It just run and gone after installation. I could not find any documentation related to this failures.
- TGrid
- TMSFMXGrid
- TeeGrid
But its running perfectly fine in windows. Not sure with Android. Haven't tried yet. My only concern now is with iOS. All the type of grids not working.
I did some basic RME TGrid sample in multi-device application for reference:
PROCEDURE
unit Unit9;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, System.Rtti,
FMX.Grid.Style, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error,
FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def, FireDAC.Stan.Pool,
FireDAC.Stan.Async, FireDAC.Phys, FireDAC.Phys.SQLite, FireDAC.Phys.SQLiteDef,
FireDAC.Stan.ExprFuncs, FireDAC.FMXUI.Wait, FireDAC.Stan.Param, FireDAC.DatS,
FireDAC.DApt.Intf, FireDAC.DApt, Data.Bind.EngExt, Fmx.Bind.DBEngExt,
Fmx.Bind.Grid, System.Bindings.Outputs, Fmx.Bind.Editors,
Data.Bind.Components, Data.Bind.Grid, Data.Bind.DBScope, Data.DB,
FireDAC.Comp.DataSet, FireDAC.Comp.Client, FMX.Controls.Presentation,
FMX.ScrollBox, FMX.Grid;
type
TForm9 = class(TForm)
grd1: TGrid;
conSqlite_demoConnection: TFDConnection;
qryCustomersTable: TFDQuery;
bdr1: TBindSourceDB;
bdl1: TBindingsList;
lnkgrdtdtsrcBindSourceDB: TLinkGridToDataSource;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form9: TForm9;
implementation
{$R *.fmx}
end.
FMX FILE
object Form9: TForm9
Left = 0
Top = 0
Caption = 'Form9'
ClientHeight = 480
ClientWidth = 289
FormFactor.Width = 320
FormFactor.Height = 480
FormFactor.Devices = [Desktop]
DesignerMasterStyle = 0
object grd1: TGrid
Align = Client
CanFocus = True
ClipChildren = True
Size.Width = 289.000000000000000000
Size.Height = 480.000000000000000000
Size.PlatformDefault = False
TabOrder = 0
RowCount = 91
Viewport.Width = 269.000000000000000000
Viewport.Height = 439.000000000000000000
end
object conSqlite_demoConnection: TFDConnection
Params.Strings = (
'ConnectionDef=SQLite_Demo')
Connected = True
LoginPrompt = False
Left = 118
Top = 206
end
object qryCustomersTable: TFDQuery
Active = True
Connection = conSqlite_demoConnection
SQL.Strings = (
'SELECT * FROM Customers')
Left = 118
Top = 254
end
object bdr1: TBindSourceDB
DataSet = qryCustomersTable
ScopeMappings = <>
Left = 128
Top = 224
end
object bdl1: TBindingsList
Methods = <>
OutputConverters = <>
Left = 20
Top = 5
object lnkgrdtdtsrcBindSourceDB: TLinkGridToDataSource
Category = 'Quick Bindings'
DataSource = bdr1
GridControl = grd1
Columns = <>
end
end
end
UPDATE 1 I my case above I used the LiveBindings but this error is true also if used through Datasource all of the 3 types of grid components.
UPDATE 2 If I set to false both fdconnection and fdquery, it works. And, if I set to true only the fdconnection, again its not working. I suspect the issue emanates from the connection itself and I also want to believe its coming from the dataset also.
UPDATE 3 Removed all the connections and manually code that instead but still no luck. I tried to figure out the error but it makes no sense to me. Connection and ConnectionName can be empty if I do it at design time.
Here's the error message:
Here's my new manual code connection:
unit Unit9;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, System.Rtti,
FMX.Grid.Style, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error,
FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def, FireDAC.Stan.Pool,
FireDAC.Stan.Async, FireDAC.Phys, FireDAC.Phys.SQLite, FireDAC.Phys.SQLiteDef,
FireDAC.Stan.ExprFuncs, FireDAC.FMXUI.Wait, FireDAC.Stan.Param, FireDAC.DatS,
FireDAC.DApt.Intf, FireDAC.DApt, Data.DB, FireDAC.Comp.DataSet,
FireDAC.Comp.Client, FMX.StdCtrls, FMX.Controls.Presentation, FMX.ScrollBox,
FMX.Grid, FMXTee.Control, FMXTee.Grid, FireDAC.Comp.UI, FireDAC.Phys.MySQLDef,
FireDAC.Phys.MySQL;
type
TForm9 = class(TForm)
btn1: TButton;
tgd1: TTeeGrid;
dvr1: TFDPhysMySQLDriverLink;
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form9: TForm9;
implementation
{$R *.fmx}
procedure TForm9.btn1Click(Sender: TObject);
var
conn : TFDConnection;
qry : TFDQuery;
ds: TDataSource;
begin
conn := TFDConnection.Create(nil);
try
//- Connection parameters
conn.Params.DriverID := 'MySQL';
conn.Params.Add('Server=127.0.0.1');
conn.Params.Database := 'mydb';
conn.Params.UserName := 'admin';
conn.Params.Password := '******';
conn.LoginPrompt := False;
//- Connect to the database..
conn.Connected := True;
if conn.Connected then begin
// ShowMessage('Connection successful.');
qry := TFDQuery.Create(conn);
try
qry.Active := False;
qry.SQL.Clear;
qry.Open('SELECT * FROM city;');
if qry.Active then
begin
if qry.RecordCount > 0 then
begin
ds := TDataSource.Create(qry);
ds.DataSet := qry;
tgd1.DataSource := ds;
end;
end;
finally
qry.Free;
end;
end else begin
ShowMessage('Connection Failed.');
end;
finally
conn.Free;
end;
end;
end.
My new FMX File:
object Form9: TForm9
Left = 0
Top = 0
Caption = 'Form9'
ClientHeight = 594
ClientWidth = 338
FormFactor.Width = 320
FormFactor.Height = 480
FormFactor.Devices = [Desktop]
DesignerMasterStyle = 0
object btn1: TButton
Align = Bottom
Position.Y = 560.000000000000000000
Size.Width = 338.000000000000000000
Size.Height = 34.000000000000000000
Size.PlatformDefault = False
TabOrder = 0
Text = 'Connect'
OnClick = btn1Click
end
object tgd1: TTeeGrid
Columns = <>
Align = Client
Size.Width = 338.000000000000000000
Size.Height = 560.000000000000000000
Size.PlatformDefault = False
TabOrder = 1
_Headers = (
1
'TColumnHeaderBand'
<
item
end>)
end
object dvr1: TFDPhysMySQLDriverLink
Left = 152
Top = 200
end
end