Hi people
How do you do a ComboBox, like a DBlookupComboBox in VCL, in a FireMonkey? Someone is using FireMonkey+LiveBindings+TAureliusDataSet to implemente a DBLookupComboBox?
Thanks
which version of Delphi? It changes a lot from version to version.
Hi Eduardo
Let's say you have:
TAureliusDataSetUser with 'Self','Id','Name' and 'UserGroupId' fields, 'UserGroupId' type TAureliusEntityField.
The auxiliar DataSet, TAureliusDataSetUserGroup with 'Self','Id','Description'.
ComboBox.SelectedValue -> connect to TAureliusDataSetUser.UserGroupId (is this correct?)
ComboBox.Item.Text -> connect TAureliusDataSetUserGroup.Description
ComboBox.Item.LookUpData -> connect to TAureliusDataSetUserGroup.Self (is this correct?)
when you call User.Get(server method), you receive on client side
Example of TAureliusDataSetUser Data:
Self = 123487, Id=1, Name= Joo, UserGroupId=546972 (TAureliusEntity)
when you call UserGroup.Get(server method), you receive on client side
Example of TAureliusDataSetUserGroup Data:
Self =845645, Id=1, Description='Big Group'
Self =657697, Id=2, Description='Small Group'
As you see, the TaureliusDataSetUser.UserGroupId differs from TAureliusDataSetUserGroup.Self (i understand that), how they will be linked?
What i'm missing?
thanks a lot, for your time
You must be sure users and groups retrieved are in the same manager, the >instance< of the objects must be the same. Your user is pointing to a group object, but your list of groups have different instances.
Hi, Wagner
Ok, only have a Manager on de server side, so i have User.Get(server methiod) and UserGroup.GetAll(server method), to load TaureliusDataSetUser i call User.Get from de server and
to load TAureliusDataSetUserGroup i call UserGroup.GetAll, in this case i have to load TaureliusDataSetUser and TaureliusDataSetUserGroup on de same call to the server method, that's it?
Thanks,
P.S. I'm using XE5, DataSnap Rest Server + JSON + Aurelius and FireMonkey+LiveBinding+TAurelius DataSet on client side.
Yes, you should do that. Or, after loading both lists, you have to update your User.GroupId instance to point to one of the instances of the list loaded by UserGroup.Get (find by id).
Ok, my server methods result a TUser Object(JSON) and a TUserGroup (JSON), if i make just one call "TUser.Get", my server method result what?
1- A TUser with Many-Value-Association to TUserGroup, like master-detail?
2- and in client side how to load TaureliusDataSetUser and TAureliusDataSetUserGroup?
3- How to refresh TuareliusDataSetUserGroup when TAureliusDataSetUser is in Edit ou Insert?
"Or, after loading both lists, you have to update your User.GroupId
instance to point to one of the instances of the list loaded by
UserGroup.Get (find by id)."
that's what i'm doing now, but i have the same question:
How to refresh TuareliusDataSetUserGroup when TAureliusDataSetUser is in Edit ou Insert?
Thanks, sorry to be so persistent, but i have to find the best solution to do that,
thanks again Wagner
The refresh is just as with any TDataset descendant, if you call Refresh, it will Post or Cancel the record then refresh. This is standard TDataset behavior.
For now forget the refresh :), and what about the "1 call" solution?
Thanks
I don't know how your server works. But maybe you could just use the second approach, which is "unify" the instances by the id.