Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ComboBoxItem setOptionCriteria exact fetch problem

    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.

    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 without setOptionCriteria:
    <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 with setOptionCriteria:
    <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>
    I am using SmartGWT/12.0p/LGPL/2019-12-02 version.

    Thanks,
    Picicom

    #2
    We've made a change which should address this issue. Please let us know if you continue to see it with builds dated Jan 11 and above

    Regards
    Isomorphic Software

    Comment

    Working...
    X