Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

ComboBox fetch missing values bug

$
0
0
The combobox is mounting the "fetch missing values" criteria wrong, it's trying to filter for the value field using the typed value.

Sample:
Code:

package com.smartgwttest.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.shared.GWT;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.types.DSProtocol;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
import com.smartgwt.client.widgets.layout.VLayout;

public class Entry implements EntryPoint {
    private VLayout contentPanel;

    private DynamicForm dynamicForm;
    private ComboBoxItem comboBoxItem;

    @Override
    public void onModuleLoad() {
        getContentPanel().draw();
    }

    private VLayout getContentPanel() {
        if (contentPanel == null) {
            contentPanel = new VLayout();
            contentPanel.setHeight100();
            contentPanel.setWidth100();
            contentPanel.setMembersMargin(10);
            contentPanel.addMembers(getDynamicForm());
        }
        return contentPanel;
    }

    public DynamicForm getDynamicForm() {
        if (dynamicForm == null) {
            dynamicForm = new DynamicForm();
            dynamicForm.setItems(getComboBoxItem());

        }
        return this.dynamicForm;
    }

    public ComboBoxItem getComboBoxItem() {
        if (comboBoxItem == null) {
            comboBoxItem = new ComboBoxItem();
            comboBoxItem.setValueField("id");
            comboBoxItem.setDisplayField("name");
            comboBoxItem.setTitle("Test Combo Box");
            comboBoxItem.setAddUnknownValues(true);
            comboBoxItem.setCompleteOnTab(false);
            comboBoxItem.setOptionDataSource(new ComboDataSource());
        }
        return this.comboBoxItem;
    }

    static class ComboDataSource extends DataSource {

        public ComboDataSource() {

            setDataProtocol(DSProtocol.CLIENTCUSTOM);

            DataSourceIntegerField id = new DataSourceIntegerField("id");
            DataSourceTextField name = new DataSourceTextField("name");

            setFields(id, name);
        }

        @Override
        protected Object transformRequest(DSRequest dsRequest) {
            Criteria criteria = dsRequest.getCriteria();
            GWT.log("id: " + criteria.getAttribute("id") + ", name: " + criteria.getAttribute("name"));

            return dsRequest;
        }

    }

}

The console output is someting like this:
Code:

id: test, name: null
id: null, name: Loading...

To reproduce the bug type something in the combobox then quickly press tab.

SmartClient Version: v9.1p_2014-03-30/LGPL Development Only (built 2014-03-30)
GWT: 2.6.0
Browser: Chromium 33.0.1750.152

Am I doing something wrong?

Viewing all articles
Browse latest Browse all 4756

Trending Articles