Announcement

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

    Bug when editing field if setShowPickerIconOnFocus(true)

    Hi Isomorphic,

    please take a look at this.
    The same code for both ListGrids except "setShowPickerIconOnFocus(true)" in the class SelectItemYesNo.
    This only applies when editing empty fields.

    Click image for larger version

Name:	bug.png
Views:	154
Size:	55.0 KB
ID:	254422

    Code:
    package com.smartgwt.sample.client;
    
    import java.util.LinkedHashMap;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.Version;
    import com.smartgwt.client.core.KeyIdentifier;
    import com.smartgwt.client.util.Page;
    import com.smartgwt.client.util.PageKeyHandler;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.IButton;
    import com.smartgwt.client.widgets.Window;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.form.fields.FormItem;
    import com.smartgwt.client.widgets.form.fields.SelectItem;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridEditorContext;
    import com.smartgwt.client.widgets.grid.ListGridEditorCustomizer;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class BuiltInDS extends VLayout implements EntryPoint {
        private IButton recreateBtn;
    
        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();
                }
            });
    
            setWidth100();
            setHeight100();
    
            recreateBtn = new IButton("Recreate");
            recreateBtn.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    new MyWindow().show();
                }
            });
            addMember(recreateBtn);
            new MyWindow().show();
            draw();
        }
    
        private class MyWindow extends Window {
            public MyWindow() {
    
                setWidth(300);
                setHeight(600);
                setMembersMargin(0);
                setModalMaskOpacity(70);
                setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")");
                setShowMinimizeButton(false);
                setIsModal(true);
                setShowModalMask(true);
                centerInPage();
    
                ListGridCustom withoutSetShowPickerIconOnFocusLG = new ListGridCustom(false);
                ListGridCustom withSetShowPickerIconOnFocusLG = new ListGridCustom(true);
    
                addItem(withoutSetShowPickerIconOnFocusLG);
                addItem(withSetShowPickerIconOnFocusLG);
            }
        }
    
        private class ListGridCustom extends ListGrid {
            public ListGridCustom(Boolean setShowPickerIconOnFocus) {
                setDataSource("animals");
                setCanEdit(true);
                final SelectItemYesNo siyn = new SelectItemYesNo(setShowPickerIconOnFocus);
                setEditorCustomizer(new ListGridEditorCustomizer() {
                    @Override
                    public FormItem getEditor(ListGridEditorContext context) {
                        return siyn;
                    }
                });
    
                ListGridField testLGF = new ListGridField("commonName");
    
                ListGridField test2LGF = new ListGridField("scientificName");
                setFields(testLGF, test2LGF);
                fetchData();
            }
        }
    
        private class SelectItemYesNo extends SelectItem {
            public SelectItemYesNo(Boolean setShowPickerIconOnFocus) {
                final LinkedHashMap<String, String> vM = new LinkedHashMap<String, String>();
                vM.put("Y", "Yes");
                vM.put("N", "No");
                setValueMap(vM);
                setAllowEmptyValue(true);
    
                if (setShowPickerIconOnFocus)
                    setShowPickerIconOnFocus(true);
                else
                    setShowPickerIconOnFocus(false);
            }
        }
    }
    Best regards
    Pavo

    #2
    Just a quick note to let you know we are reproducing this issue and our developers are investigating

    Comment


      #3
      This issue has now been resolved.
      Please try the next nightly build, dated Aug 16 or above, 12.0 and 12.1 branches

      Comment


        #4
        Hi Isomorphic,

        I tried and it's working, thank you!

        Best regards
        Pavo

        Comment

        Working...
        X