Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext User
    Join Date
    Jul 2009
    Posts
    5
    Vote Rating
    0
    flyinghang is on a distinguished road

      0  

    Default [CLOSED] Bug in SimpleComboBox and FormBinding?

    [CLOSED] Bug in SimpleComboBox and FormBinding?


    hi all,
    I am using a Grid and a Form with a FormBinding, a combobox , a TextField and a submit button,
    when user select a grid row, then combobox and textfield will display the field value of the row, then user can modify the value in combobox(setforceselection = false) or in the TextField, but I found if user press the Test button, value in TextField can send back to grid correctly, but the combobox is not unless user click the TextField(force to blur).

    Here is the test code, just click the grid row, and then change the value of combobox, do nothing but just press the Test button. if store.getModifiedRecords = 0, a Info will display.
    if the bug won't show, just try again.
    GWT version: 1.6
    GXT version: 2.0
    Hosted Mode
    Windows XP




    Code:
    package com.flyinghang.test.client;
    
    import java.util.ArrayList;
    import java.util.List;
    
    import com.extjs.gxt.ui.client.Style.SelectionMode;
    import com.extjs.gxt.ui.client.binding.FormBinding;
    import com.extjs.gxt.ui.client.binding.SimpleComboBoxFieldBinding;
    import com.extjs.gxt.ui.client.data.BaseModelData;
    import com.extjs.gxt.ui.client.event.ComponentEvent;
    import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
    import com.extjs.gxt.ui.client.event.SelectionChangedListener;
    import com.extjs.gxt.ui.client.store.ListStore;
    import com.extjs.gxt.ui.client.widget.ContentPanel;
    import com.extjs.gxt.ui.client.widget.Info;
    import com.extjs.gxt.ui.client.widget.Viewport;
    import com.extjs.gxt.ui.client.widget.button.Button;
    import com.extjs.gxt.ui.client.widget.form.FormPanel;
    import com.extjs.gxt.ui.client.widget.form.SimpleComboBox;
    import com.extjs.gxt.ui.client.widget.form.TextField;
    import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
    import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
    import com.extjs.gxt.ui.client.widget.grid.Grid;
    import com.extjs.gxt.ui.client.widget.layout.FitLayout;
    import com.extjs.gxt.ui.client.widget.layout.RowData;
    import com.extjs.gxt.ui.client.widget.layout.RowLayout;
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.user.client.ui.RootPanel;
    
    public class Test implements EntryPoint {
    
    	@Override
    	public void onModuleLoad() {
    		// TODO Auto-generated method stub
    		
    		Viewport port = new Viewport();
    		
    		port.setLayout(new FitLayout());
    		ContentPanel c = new ContentPanel();
    		c.setHeight(500);
    		c.setHeading("Combobox test");
    		
    		c.setLayout(new RowLayout());
    		
    		FormPanel p = new FormPanel();
    		p.setHeaderVisible(false);
    		
    		c.add(p);
    		
    		SimpleComboBox<String> cb = new SimpleComboBox<String>();
    		cb.setForceSelection(false);
    		
    		cb.add("a");
    		cb.add("b");
    		cb.add("c");
    		
    		cb.setName("value");
    		cb.setFieldLabel("Test");
    		p.add(cb);
    		
    		TextField<String> txt = new TextField<String>();
    		txt.setName("value");
    		txt.setFieldLabel("Test2");
    		p.add(txt);
    		
    		
    		
    		final FormBinding binding = new FormBinding(p);
    		binding.addFieldBinding(new SimpleComboBoxFieldBinding(cb, "value") {
    
    			/* (non-Javadoc)
    			 * @see com.extjs.gxt.ui.client.binding.SimpleComboBoxFieldBinding#onConvertModelValue(java.lang.Object)
    			 */
    			@Override
    			protected Object onConvertModelValue(Object value) {
    				// TODO Auto-generated method stub
    				
    				Object o =  super.onConvertModelValue(value);
    				if (o == null) {
    					simpleComboBox.add((String)value);
    				}
    				
    				return super.onConvertModelValue(value);
    			}
    			
    		});
    		
    		binding.autoBind();
    		
    		final ListStore<BaseModelData> store = new ListStore<BaseModelData>();
    		store.setMonitorChanges(true);
    		BaseModelData data = new BaseModelData();
    		data.set("value", "aaa");
    		store.add(data);
    		data = new BaseModelData();
    		data.set("value", "bbbbbbb");
    		store.add(data);
    		
    		binding.setStore(store);
    
    		p.addButton(new Button("Test") {
    
    			/* (non-Javadoc)
    			 * @see com.extjs.gxt.ui.client.widget.button.Button#onClick(com.extjs.gxt.ui.client.event.ComponentEvent)
    			 */
    			@Override
    			protected void onClick(ComponentEvent ce) {
    				// TODO Auto-generated method stub
    				
    				if (store.getModifiedRecords().size() == 0) {
    					Info.display("the modified record count 0","error");
    					store.rejectChanges();
    					return;
    				}
    				store.commitChanges();
    			}
    			
    		});
    		
    		
    		
    		List<ColumnConfig> cfg = new ArrayList<ColumnConfig>();
    		cfg.add(new ColumnConfig("value", "Value", 100));
    		
    		ColumnModel cm = new ColumnModel(cfg);
    		
    		
    		Grid<BaseModelData> g = new Grid<BaseModelData>(store,cm);
    		
    		g.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
    		g.getSelectionModel().addSelectionChangedListener(new SelectionChangedListener<BaseModelData>() {
    
    			@Override
    			public void selectionChanged(SelectionChangedEvent<BaseModelData> se) {
    				// TODO Auto-generated method stub
    				binding.bind(se.getSelectedItem());
    				
    			}});
    		
    		c.add(g, new RowData(1,1));
    		
    		
    		port.add(c);
    		
    		RootPanel.get().add(port);
    		
    		
    
    	}
    
    }

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,966
    Vote Rating
    130
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    There is an issue in your code. You override onClick and removing much logic.

    You should do that with a selectionlistener. I am closing this issue.

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar