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

RecordClickHandler is NOT working for picklist!

$
0
0
When setting picklist properties on a ComboBoxItem, the addRecordClickHandler does not get fired upon click.

Here's a simple TestCase to show the problem.
The TestDS is a GwtRpcDataSource in which implementation, the fetch returns a list of (Integer id, String name);

Code:

package org.test.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Window;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
import org.test.client.ds.TestDS;

public class MainEntryPoint implements EntryPoint {

    private final DynamicForm form = new DynamicForm();
    private final TestDS datasource = new TestDS();

    public MainEntryPoint() {
    }

    @Override
    public void onModuleLoad() {
        ComboBoxItem combo = new ComboBoxItem("Test");
        combo.setValueField("id");
        combo.setDisplayField("name");
        combo.setOptionDataSource(datasource);

        ListGridField idField = new ListGridField("id");
        ListGridField nameField = new ListGridField("name");
        combo.setPickListFields(idField, nameField);

        ListGrid pickListProperties = new ListGrid();
        pickListProperties.addRecordClickHandler(new RecordClickHandler() {

            @Override
            public void onRecordClick(RecordClickEvent event) {
                Window.alert("CLICKED");
            }
        });
        combo.setPickListProperties(pickListProperties);

        form.setItems(combo);
        form.draw();
    }
}

It doesn't work regardless of browser!

GWT 2.5.1
SmartGwt - latest nightly build from 2013-12-05
(SmartGWT/4.0p/LGPL)

Viewing all articles
Browse latest Browse all 4756