I have the following two datasources:
I have the classic window with 3 widgets on ListGrid, DetailViewer, and one DynamicForm.
They are connected just the same as in the example provided by smartgwt (item, category).
This code is working fine for a table that has no foreign keys.
Now I am reusing the code and the ListGrid top portion shows fine all the fields except for the one that has a foreign key. In this case it shows the name of the current selected item instead of the name of the foreignKey both tables have the same column name.
When I click in a row in this list the viewer and the form both show in the column with the foreign key the text "[object Object]" in the DynamicForm I get the drop down and the list is correctly fetch from the other datasource except for the selected item is as mention above.
I am not sure what to do here. Here is my code for the ListGrid
Thanks
Code:
<DataSource ID="buildReleaseDMI" serverType="generic" dropExtraFields="true"> <fields> <field name="id" type="sequence" hidden="true" primaryKey="true"/> <field name="name" type="text" title="Name" length="124" required="true"/> <field name="urlLocation" type="text" title="URL" length="1024" required="true"/> <field name="enabled" type="boolean" title="Enabled" required="false"/> </fields> <serverObject lookupStyle="new" className="com.db.am.dbinsight.web.dai.server.dmi.BuildReleaseDMI"/> </DataSource>
Code:
<DataSource ID="projectDMI" serverType="generic" dropExtraFields="true" > <fields> <field name="id" type="sequence" hidden="true" primaryKey="true"/> <field name="name" type="text" title="Name" length="255" required="true"/> <field name="buildRelease" type="integer" title="Release" required="true" constructor="ComboBoxItem" foreignKey="buildReleaseDMI.id"> <valueField>id</valueField> <displayField>name</displayField> </field> <serverObject lookupStyle="new" className="com.db.am.dbinsight.web.dai.server.dmi.ProjectDMI"/> </DataSource>
They are connected just the same as in the example provided by smartgwt (item, category).
This code is working fine for a table that has no foreign keys.
Now I am reusing the code and the ListGrid top portion shows fine all the fields except for the one that has a foreign key. In this case it shows the name of the current selected item instead of the name of the foreignKey both tables have the same column name.
When I click in a row in this list the viewer and the form both show in the column with the foreign key the text "[object Object]" in the DynamicForm I get the drop down and the list is correctly fetch from the other datasource except for the selected item is as mention above.
I am not sure what to do here. Here is my code for the ListGrid
Code:
public class ProjectGrid extends ListGrid { private final DataSource projectDS = DataSource.get("projectDMI"); public ProjectGrid(){ setDataSource(projectDS); setUseAllDataSourceFields(true); setAutoFetchData(true); ListGridField itemName = new ListGridField("name","Name"); itemName.setShowHover(true); itemName.setWidth(50); ListGridField countryCodeField = new ListGridField("countryCode", "Region", 50); countryCodeField.setAlign(Alignment.CENTER); countryCodeField.setType(ListGridFieldType.IMAGE); countryCodeField.setImageURLPrefix("flags/16/"); countryCodeField.setImageURLSuffix(".png"); setFields(itemName,countryCodeField); setCanEdit(false); setCanDragRecordsOut(false); setHeight(120); setWidth100(); setSelectionType(SelectionStyle.SINGLE); setRecordEnabledProperty(null); } }
Comment