I'm trying to produce a ListGrid that will display a list of customers, showing first name and last name along with their preferred addresses.
Addresses in this system are immutable shared objects with a sequenced ID field, and the Customer object has a preferredAddress field with a foreign key to a particular address:
customer.ds.xml
physicalAddress.ds.xml
When I create a ListGrid with the "customer" DataSource and no specified fields, I see all the customer information and [Object object], as seen in several other threads.
Unlike in the Data Selection example, I am not wanting to flatten the DataSource to present address information as part of the customer's record; these addresses are needed in several parts of the system, and I just want to display part of the joined address to help users select the correct customer.
I thought for some reason that adding a ListGridField("preferredAddress.line1") would make the grid follow the foreign key to the "preferredAddress" DataSource, but instead I get blank lines, and the server doesn't indicate a fetch for addresses.
What should I be doing instead to have the grid field reflect a value from a different but related DataSource?
Addresses in this system are immutable shared objects with a sequenced ID field, and the Customer object has a preferredAddress field with a foreign key to a particular address:
customer.ds.xml
Code:
<field name="id" type="sequence" hidden="true" primaryKey="true" /> <field name="givenName" type="text" required="true" /> <field name="familyName" type="text" required="true" /> <field name="preferredAddress" type="integer" foreignKey="physicalAddress.id" />
Code:
<field name="id" type="sequence" hidden="true" primaryKey="true" /> <field name="line1" type="text" required="true" /> <field name="line2" type="text" /> <field name="city" type="text" required="true" /> <field name="st" type="text" required="true" /> <field name="zip" type="integer" required="true" />
When I create a ListGrid with the "customer" DataSource and no specified fields, I see all the customer information and [Object object], as seen in several other threads.
Unlike in the Data Selection example, I am not wanting to flatten the DataSource to present address information as part of the customer's record; these addresses are needed in several parts of the system, and I just want to display part of the joined address to help users select the correct customer.
I thought for some reason that adding a ListGridField("preferredAddress.line1") would make the grid follow the foreign key to the "preferredAddress" DataSource, but instead I get blank lines, and the server doesn't indicate a fetch for addresses.
What should I be doing instead to have the grid field reflect a value from a different but related DataSource?
Comment