Announcement

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

    Wrong(?) warning in Developer Console when saving ComboBoxItem selection

    Hi Isomorphic,

    please see this testcase (v10.0p_2015-08-24):
    Code:
    package com.smartgwt.sample.client;
    
    import java.util.LinkedHashMap;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.core.KeyIdentifier;
    import com.smartgwt.client.data.AdvancedCriteria;
    import com.smartgwt.client.data.Criterion;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.types.OperatorId;
    import com.smartgwt.client.util.PageKeyHandler;
    import com.smartgwt.client.util.Page;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.IButton;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.form.DynamicForm;
    import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
    import com.smartgwt.client.widgets.form.fields.FormItem;
    import com.smartgwt.client.widgets.form.fields.HiddenItem;
    import com.smartgwt.client.widgets.form.fields.SelectItem;
    import com.smartgwt.client.widgets.form.fields.TextItem;
    import com.smartgwt.client.widgets.layout.HLayout;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class BuiltInDS implements EntryPoint {
    	private VLayout vL;
    	private TestForm tF;
    	private HLayout hL;
    
    	public void onModuleLoad() {
    		KeyIdentifier debugKey = new KeyIdentifier();
    		debugKey.setCtrlKey(true);
    		debugKey.setKeyName("D");
    
    		Page.registerKey(debugKey, new PageKeyHandler() {
    			public void execute(String keyName) {
    				SC.showConsole();
    			}
    		});
    
    		vL = new VLayout(5);
    		vL.setTop(20);
    		vL.setLeft(20);
    		vL.setWidth100();
    		vL.setHeight100();
    
    		tF = new TestForm(false);
    		hL = new HLayout(5);
    
    		IButton recreateCBI = new IButton("Recreate ComboBoxItem");
    		recreateCBI.setWidth(200);
    		recreateCBI.addClickHandler(new ClickHandler() {
    			@Override
    			public void onClick(ClickEvent event) {
    				vL.removeMember(tF);
    				tF.markForDestroy();
    				tF = new TestForm(false);
    				vL.addMember(tF, 0);
    			}
    		});
    
    		IButton recreateSI = new IButton("Recreate SelectItem");
    		recreateSI.setWidth(200);
    		recreateSI.addClickHandler(new ClickHandler() {
    			@Override
    			public void onClick(ClickEvent event) {
    				vL.removeMember(tF);
    				tF.markForDestroy();
    				tF = new TestForm(true);
    				vL.addMember(tF, 0);
    			}
    		});
    
    		IButton save = new IButton("Save");
    		save.addClickHandler(new ClickHandler() {
    			@Override
    			public void onClick(ClickEvent event) {
    				tF.saveData();
    			}
    		});
    
    		hL.addMembers(recreateCBI, recreateSI, save);
    		vL.addMembers(tF, hL);
    		vL.draw();
    	}
    
    	private class TestForm extends DynamicForm {
    		public TestForm(boolean useSelectItem) {
    			super();
    			setDataSource(DataSource.get("supplyItem"));
    			setAutoFetchData(false);
    			setWidth("95%");
    			setTitleWidth(180);
    			setCellPadding(7);
    			setCanEdit(true);
    			setNumCols(2);
    
    			HiddenItem itemID = new HiddenItem("itemID");
    			itemID.setFetchMissingValues(false);
    
    			// String[] and LinkedHashMap to demonstrate the bug
    			String[] valueList = { "1", "2", "5", "10" };
    			LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
    			for (String value : valueList)
    				valueMap.put("String:" + value, "String:" + value);
    
    			final TextItem itemNameTI = new TextItem("itemName");
    			final TextItem sku = new TextItem("SKU");
    
    			final FormItem unitCost;
    			final FormItem desc;
    
    			if (!useSelectItem) {
    				// Bug
    				unitCost = new ComboBoxItem("unitCost");
    				unitCost.setValueMap(valueList);
    				// Bug
    				desc = new ComboBoxItem("description");
    				desc.setValueMap(valueMap);
    			} else {
    				// OK
    				unitCost = new SelectItem("unitCost");
    				unitCost.setValueMap(valueList);
    				// OK
    				desc = new SelectItem("description");
    				desc.setValueMap(valueMap);
    			}
    
    			setFields(itemID, itemNameTI, sku, unitCost, desc);
    			fetchData(new AdvancedCriteria(new Criterion("itemID", OperatorId.EQUALS, 1)));
    		}
    	}
    }
    If you change the ComboBoxItem selection and save, you'll let the following Developer Console logs:
    Code:
    06:30:58.495:XRP7:WARN:fetchMissingValues:isc_ComboBoxItem_10[description]:Deriving valueMap for 'description' from dataSource based on displayField 'undefined'. This dataSource contains more than one record with description set to String:10 with differing undefined values. Derived valueMap is therefore unpredictable.
    06:31:05.305:XRP0:WARN:fetchMissingValues:isc_ComboBoxItem_10[description]:Deriving valueMap for 'description' from dataSource based on displayField 'undefined'. This dataSource contains more than one record with description set to String:10 with differing undefined values. Derived valueMap is therefore unpredictable.
    06:31:05.324:XRP0:WARN:fetchMissingValues:isc_ComboBoxItem_9[unitCost]:Deriving valueMap for 'unitCost' from dataSource based on displayField 'undefined'. This dataSource contains more than one record with unitCost set to 1 with differing undefined values. Derived valueMap is therefore unpredictable.
    For me, it does not always happen for both ComboBoxItems, but always for at least one.
    It does not happen at all for SelectItems.

    Best regards
    Blama

    #2
    Hi Isomorphic,

    could you look into this one already (not high priority for me)?

    Best regards
    Blama

    Comment


      #3
      Don't worry, this is queued to be looked at, it's just behind other items that have more serious effects than (possibly) spurious warnings.

      Comment


        #4
        This issue is now resolved in the 10.1d branch

        Regards
        Isomorphic Software

        Comment

        Working...
        X