Hi Isomorphic,
When using ComboBoxItem.setOptionCriteria, then in the case of an exact fetch (e.g. after a setValue) the condition for the ID field is
iContains operator, which is not appropriate for a number value. Anyway, it probably should always be equals.
Request without setOptionCriteria:
Request with setOptionCriteria:
I am using SmartGWT/12.0p/LGPL/2019-12-02 version.
Thanks,
Picicom
When using ComboBoxItem.setOptionCriteria, then in the case of an exact fetch (e.g. after a setValue) the condition for the ID field is
iContains operator, which is not appropriate for a number value. Anyway, it probably should always be equals.
Code:
public class GWTTest implements EntryPoint { public void onModuleLoad() { DynamicForm form = new DynamicForm(); ComboBoxItem cbItem = new ComboBoxItem("CB_ITEM"); RestDataSource dataSource = new RestDataSource(); dataSource.setDataURL("ds.jsp"); dataSource.setDataFormat(DSDataFormat.XML); dataSource.setDisableQueuing(true); OperationBinding fetch = new OperationBinding(); fetch.setOperationType(DSOperationType.FETCH); fetch.setDataProtocol(DSProtocol.POSTMESSAGE); dataSource.setOperationBindings(fetch); DataSourceField keyField = new DataSourceIntegerField("ID_FIELD"); keyField.setPrimaryKey(true); keyField.setHidden(true); DataSourceField extraField = new DataSourceTextField("EXTRA_FIELD"); extraField.setHidden(true); DataSourceField displayField = new DataSourceTextField("DISPLAY_FIELD"); dataSource.setFields(keyField, extraField, displayField); cbItem.setOptionDataSource(dataSource); cbItem.setValueField("ID_FIELD"); cbItem.setDisplayField("DISPLAY_FIELD"); cbItem.setOptionCriteria(new Criterion("EXTRA_FIELD", OperatorId.EQUALS, "HU")); form.setItems(cbItem); cbItem.setValue("101"); form.draw(); } }
<request>
<data>
<ID_FIELD>101</ID_FIELD>
</data>
<dataSource>isc_RestDataSource_0</dataSource>
<operationType>fetch</operationType>
<textMatchStyle>exact</textMatchStyle>
<componentId>isc_DynamicForm_0</componentId>
<oldValues></oldValues>
</request>
<data>
<ID_FIELD>101</ID_FIELD>
</data>
<dataSource>isc_RestDataSource_0</dataSource>
<operationType>fetch</operationType>
<textMatchStyle>exact</textMatchStyle>
<componentId>isc_DynamicForm_0</componentId>
<oldValues></oldValues>
</request>
<request>
<data>
<_constructor>AdvancedCriteria</_constructor>
<criteria>
<criterion>
<fieldName>EXTRA_FIELD</fieldName>
<operator>equals</operator>
<value>HU</value>
</criterion>
<criterion>
<fieldName>ID_FIELD</fieldName>
<operator>iContains</operator>
<value>101</value>
</criterion>
</criteria>
<operator>and</operator>
</data>
<dataSource>isc_RestDataSource_0</dataSource>
<operationType>fetch</operationType>
<textMatchStyle>exact</textMatchStyle>
<componentId>isc_DynamicForm_0</componentId>
<oldValues></oldValues>
</request>
<data>
<_constructor>AdvancedCriteria</_constructor>
<criteria>
<criterion>
<fieldName>EXTRA_FIELD</fieldName>
<operator>equals</operator>
<value>HU</value>
</criterion>
<criterion>
<fieldName>ID_FIELD</fieldName>
<operator>iContains</operator>
<value>101</value>
</criterion>
</criteria>
<operator>and</operator>
</data>
<dataSource>isc_RestDataSource_0</dataSource>
<operationType>fetch</operationType>
<textMatchStyle>exact</textMatchStyle>
<componentId>isc_DynamicForm_0</componentId>
<oldValues></oldValues>
</request>
Thanks,
Picicom
Comment