Greetings,
I have the following server-side data model:
I'm trying to build a UI where I have a ListGrid for As. It shows A's standard fields, along with "mostRecentB.text". The A ListGrid "canExpandRecords", and in the expansion I want a nested B ListGrid for the full history of all Bs for the given A.
I want to allow the user to add a new B via the A ListGrid. The id and timestamp can be generated server-side, so the user would simply be presented with an inline text field for B.text in the related cell. Upon submit I want both the A and B ListGrids to update accordingly.
I also want the user to be able to add a new B via the nested B ListGrid, and again the associated A.mostRecentB.text in the A ListGrid needs to be updated in the UI when this happens.
I have an A custom DataSource for the A ListGrid:
And a B custom DataSource for the B ListGrid:
My understanding for adding a new B via the B ListGrid is that I would ensure A.mostRecentB is updated by way of a server-side call to dsResponse.addRelatedUpdate.
My question is what is the best way to specify the A DataSource descriptor for A.mostRecentB? Would I be better off to add a "String mostRecentBText" to my A model, and map that instead of the entire mostRecentB entity? With this approach I presume I would again need to use dsResponse.addRelatedUpdate server-side to update the B DataSource.
Alternatively should I use foreignKey to associate A.mostRecentB with the B DataSource? If so how would that look with mostRecentB being a composed entity? Would it work if B had a composite primary key (in 8.3)?
Thanks,
Ian
SmartClient Version: v8.2p_2012-06-06/Pro Deployment (built 2012-06-06).
I have the following server-side data model:
Code:
---------------------- | A | |--------------------| | Long id <PK> | | String foo | | String bar | | B mostRecentB | ---------------------- ------------------ | B | |----------------| | Long id <PK> | | String text | | Date timestamp | ------------------
I want to allow the user to add a new B via the A ListGrid. The id and timestamp can be generated server-side, so the user would simply be presented with an inline text field for B.text in the related cell. Upon submit I want both the A and B ListGrids to update accordingly.
I also want the user to be able to add a new B via the nested B ListGrid, and again the associated A.mostRecentB.text in the A ListGrid needs to be updated in the UI when this happens.
I have an A custom DataSource for the A ListGrid:
Code:
<DataSource ID="ADataSource" serverConstructor="spring:aDataSource" schemaBean="com.mycompany.A"> <fields> <!-- Not sure if this is necessary with autoDeriveSchema?... --> <field primaryKey="true" name="id" /> </fields> </DataSource>
Code:
<DataSource ID="BDataSource" serverConstructor="spring:bDataSource" schemaBean="com.mycompany.B"> <fields> <field primaryKey="true" name="id" /> </fields> </DataSource>
My question is what is the best way to specify the A DataSource descriptor for A.mostRecentB? Would I be better off to add a "String mostRecentBText" to my A model, and map that instead of the entire mostRecentB entity? With this approach I presume I would again need to use dsResponse.addRelatedUpdate server-side to update the B DataSource.
Alternatively should I use foreignKey to associate A.mostRecentB with the B DataSource? If so how would that look with mostRecentB being a composed entity? Would it work if B had a composite primary key (in 8.3)?
Thanks,
Ian
SmartClient Version: v8.2p_2012-06-06/Pro Deployment (built 2012-06-06).
Comment