Hybrid View

  1. #1
    Ext User ScotlynHatt's Avatar
    Join Date
    Nov 2010
    Location
    Northern VA, USA
    Posts
    2
    Vote Rating
    0
    ScotlynHatt is on a distinguished road

      0  

    Default ComboBox in Popup Problem

    ComboBox in Popup Problem


    Hello,

    I searched quite extensively but was unable to locate anything close to what I am encountering. Apologies if this is not a bug or is already known.

    I am using a Popup to display a FormPanel that includes a ComboBox. When I attempt to select an entry using the left-mouse click after successfully expanding the list using the left mouse click, the Popup hides itself. When the Popup is displayed again, the ComboBox has no value as if the click did not register.

    Interestingly, I can mouse-over the expanded list and then use the keyboard to navigate and successfully select an entry in the ComboBox without the Popup closing.

    Tested in FF3 & IE8. Test case follows.

    Code:
    public class PortalApp2 extends LayoutContainer implements EntryPoint {
    
        @Override
        public void onModuleLoad() {
            final Popup popup = new Popup();
            popup.setAutoWidth(false);
            popup.setAutoHeight(false);
            popup.setBounds(500, 300, 500, 300);
    
            final Portal portal = new Portal(2);
            portal.setPixelSize(500, 500);
            portal.setBorders(true);
            portal.setStyleAttribute("backgroundColor", "white");
    
            final Portlet portlet = new Portlet();
            portlet.setHeading("Popup Launcher");
            portlet.setLayout(new FitLayout());
            portlet.setPixelSize(400, 400);
            configPanel(portlet);
            
            final Button popupButton = new Button("Launch Popup");
            popupButton.setPixelSize(100, 50);
            popupButton.addListener(
                Events.Select,
                new SelectionListener<ButtonEvent>() {
                    @Override
                    public void componentSelected(final ButtonEvent event) {
                        popup.show();
                    }
                });
    
            final FormPanel uploadForm = new FormPanel();
            uploadForm.setHeading("Enter Information");
            uploadForm.setFrame(true);
            uploadForm.setAction("#");
            uploadForm.setButtonAlign(HorizontalAlignment.CENTER);
            uploadForm.setWidth(350);
            uploadForm.setId("myForm");
            
            final TextField<String> someText = new TextField<String>();
            someText.setFieldLabel("Some Text Here");
            uploadForm.add(someText);
            
            final ComboBox<ModelData> combo = new ComboBox<ModelData>();
            combo.setFieldLabel("Value");
            combo.setId("valueCombo");
            combo.setAllowBlank(false);
            combo.setDisplayField("value");
            combo.setEditable(true);
            combo.setTriggerAction(TriggerAction.ALL);
            combo.setStore(getData());
            uploadForm.add(combo);
    
            popup.add(uploadForm);
            
            portlet.add(popup);
            portlet.add(popupButton);
    
            portal.add(portlet, 1);
    
            RootPanel.get().add(portal);
        }
    
        private ListStore<ModelData> getData() {
            ListStore<ModelData> valList = new ListStore<ModelData>();
            final String[] values =
                { "Value1", "Value2", "Value3", "Value4", "Value5",
                    "Value6", "Value7", "Value8", "Value9",
                    "Value10", "Value11", "Value12", "Value13", "Value14" };
            int i = 0;
            for (String value: values) {
                KeyValueModel model = new KeyValueModel();
                model.setKey("" + i++);
                model.setValue(value);
                valList.add(model);
            }
            return valList;
        }
    
        private void configPanel(final Portlet portlet) {
            portlet.setCollapsible(true);
            portlet.setAnimCollapse(false);
            portlet.getHeader().addTool(new ToolButton("x-tool-gear"));
            portlet.getHeader().addTool(
                new ToolButton("x-tool-close",
                    new SelectionListener<IconButtonEvent>() {
    
                        @Override
                        public void componentSelected(IconButtonEvent ce) {
                            portlet.removeFromParent();
                        }
                    }));
        }
    
        @SuppressWarnings("serial")
        private class KeyValueModel extends BaseModelData {
            public KeyValueModel() {}
    
            public KeyValueModel(String key, String value) {
                setKey(key);
                setValue(value);
            }
    
            public String getKey() { return get("key"); }
    
            public void setKey(String key) { set("key", key); }
    
            public String getValue() { return get("value"); }
    
            public void setValue(String value) { set("value", value); }
        }
    }

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    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


    The problem is that the list is not a direct child of the Popup element. You configure your popup with autoHide.

    You need to do something like this:
    Code:
    final ComboBox<ModelData> combo = new ComboBox<ModelData>();
        final Popup popup = new Popup() {
          @Override
          protected boolean onAutoHide(Event event) {
            return !combo.isExpanded() && event.getTypeInt() != Event.ONMOUSEUP;
          }
        };

  3. #3
    Ext User ScotlynHatt's Avatar
    Join Date
    Nov 2010
    Location
    Northern VA, USA
    Posts
    2
    Vote Rating
    0
    ScotlynHatt is on a distinguished road

      0  

    Red face Works like a charm

    Works like a charm


    Thank you Sven, that works like a charm.

Similar Threads

  1. Combobox dropdown not showing in popup window for IE
    By rwong2000 in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 7 Jun 2010, 8:41 AM
  2. [FIXED] [2.0 M1] ComboBox, wrong popup position in webkit
    By Ezor in forum Ext GWT: Bugs (2.x)
    Replies: 2
    Last Post: 6 May 2009, 7:41 AM
  3. combobox in popup win works first time only
    By lkasdorf in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 5 Mar 2009, 6:45 AM
  4. Deferred popup from ComboBox select handler
    By harperml in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 24 Dec 2008, 9:11 AM
  5. Replies: 1
    Last Post: 13 Aug 2008, 11:01 AM

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi