That's not correct usage (there is no DataSourceField.optionDataSource property) and will result in undesirable side-effects - it effectively sets ListGridField.optionDataSource (loads entire related DataSource - only OK for smaller datasets).
The "foreignKey" declaration is the correct approach - just look for typos to see why it didn't work before.
Instead of <pickListCriteria> (also incorrect usage), you can set optionOperationId to use specific operation from the related DataSource which can have special <criteria> (using Velocity templates), limited <outputs>, etc.
Announcement
Collapse
No announcement yet.
X
-
Thanks. Although "foreignKey" setting didn't work for me. But i found below ds field attribute on a thread and they works fine.
<field name="empId" type="integer" title= "Emp" editorType="ComboBoxItem" optionDataSource="employees" valueField="id" displayField="Name">
<!-- <pickListCriteria> <status>Protected</status> </pickListCriteria>-->
</field>
But now is it possible to add more display fields here through ds.xml file (similar to setPickListFields())?
And can this <pickListCriteria> could be velocity template to use other fields from same data source?
Leave a comment:
-
Yes, if you just declare a foreignKey relationship, that's what will happen (except it will default to a SelectItem, which you can override with editorType="ComboBoxItem"). The explicit setting for this is SelectItem/ComboBox.setOptionDataSource().
Leave a comment:
-
Data Source field backed by Data Source
Hi,
Is it possible to have a data source field which are backed by data source? I am looking for a case where a form has a field which allow lookup using ComboBoxItem (which uses a data source to fetch data from db)?Tags: None
Leave a comment: