Hi All,
I am facing of problem of ID being displayed instead of value.
Datasource:
In edit mode I get the list in selectitem and on change works fine and displays desc. But as soon as I click outside the grid(Edit complete). The selectitem starts displaying ID. Any suggestions?
Thanks in advance
I am facing of problem of ID being displayed instead of value.
Code:
grid.setEditorCustomizer(customizer -> { if (customizer.getEditField().getName().equals("desc")) { Record record = customizer.getEditedRecord(); final DataSource myDS = DataSource.get("myDS"); final SelectItem selectItem = new SelectItem(); selectItem.setOptionDataSource(myDS); selectItem.setSortField("desc"); selectItem.setDisplayField("desc"); selectItem.setValueField("id"); selectItem.setWidth("100%"); selectItem.setAutoFetchData(false); selectItem.setAllowEmptyValue(false); selectItem.setAddUnknownValues(false); return selectItem; } return customizer.getDefaultProperties(); });
Code:
<DataSource ID="myDS" serverType="hibernate" beanClassName="com.xyz.MyClass" lookupStyle="spring" beanFactory="org.springframework.beans.factory.BeanFactory" autoDeriveSchema="true" configBean="sessionFactory"> <fields> <field name="id" type="long" align="left" hidden="true" primaryKey="true" /> <field name="desc" type="text" align="left"/> </fields> <operationBindings> <binding operationType="fetch" outputs="id,desc" /> </operationBindings> </DataSource>
Thanks in advance
Comment