Hi,
I have a Datasource Location with a foreign key relation to Datasource LocationType.
In A Location TreeGrid, I want to show location records together with the description of their linked LocationType record.
The problem is that the TreeGrid shows the Id of the LocationType and not the Description, however if you doubleclick the tree row, you get a SelectItem and there it shows the correct picklist of locationtype descriptions. Once you opened the select item once on a row and close it again, the id is replaced with the description.
(So the problem only seems to be that initially the display fields are not fetched)
Source:
TreeGridField typeField = new TreeGridField("locationTypePk", "Type");
typeField.setAutoFetchDisplayMap(true);
typeField.setOptionDataSource(DataSources.get("LocationType"));
typeField.setDisplayField("lctp_description");
DS Location
<field type="integer" name="locationTypePk" foreignKey="LocationType.lctp_pk" title=""></field>
DS LocationType
<field primaryKey="true" type="sequence" name="lctp_pk" hidden="true" canEdit="false"></field>
<field type="text" length="45" name="lctp_description" title="" ></field>
I thought typeField.setAutoFetchDisplayMap(true) would fix this problem but no luck so far.
Thanks for your help
David
I have a Datasource Location with a foreign key relation to Datasource LocationType.
In A Location TreeGrid, I want to show location records together with the description of their linked LocationType record.
The problem is that the TreeGrid shows the Id of the LocationType and not the Description, however if you doubleclick the tree row, you get a SelectItem and there it shows the correct picklist of locationtype descriptions. Once you opened the select item once on a row and close it again, the id is replaced with the description.
(So the problem only seems to be that initially the display fields are not fetched)
Source:
TreeGridField typeField = new TreeGridField("locationTypePk", "Type");
typeField.setAutoFetchDisplayMap(true);
typeField.setOptionDataSource(DataSources.get("LocationType"));
typeField.setDisplayField("lctp_description");
DS Location
<field type="integer" name="locationTypePk" foreignKey="LocationType.lctp_pk" title=""></field>
DS LocationType
<field primaryKey="true" type="sequence" name="lctp_pk" hidden="true" canEdit="false"></field>
<field type="text" length="45" name="lctp_description" title="" ></field>
I thought typeField.setAutoFetchDisplayMap(true) would fix this problem but no luck so far.
Thanks for your help
David
Comment