1. #1
    Ext User
    Join Date
    Apr 2008
    Posts
    18
    Vote Rating
    0
    baluba is on a distinguished road

      0  

    Default [FIXED] ComboBox Store cannot be changed

    [FIXED] ComboBox Store cannot be changed


    The example code below illustrates some problems with the ComboBox:
    • When the combox is created its Store must have at least one item, otherwise the Combo wont display anything, even if the store is changed in a listener etc.
    • .
    • Calling removeAll on a ComboBox's Store doesn't remove the item that was part of the Store when combobox was created.
    • .
    • In the example attached, if you click the ComboBox before you click the button, the ComboBox will not display properly after you add items by clicking the button.
    • .
    • If you click the button first, the combo will layout ok, but the "dummy" item is still there.
    Code:
    public class Main implements EntryPoint {
        private Viewport viewport;
    
        public class MyModel extends BaseModel {
            public MyModel() {
            }
    
            public MyModel(String name, Integer age) {
                set("name", name);
                set("age", age);
            }
        }
    
        public void onModuleLoad() {
            viewport = new Viewport();
            viewport.setLayout(new FlowLayout());
    
            Store store = new Store();
            // if next line is commented out the combo doesn't display any items
            store.add(new Record(new MyModel("dummy", 5)));
    
            final ComboBox combo = new ComboBox();
            combo.setWidth(100);
            combo.fieldLabel = "whatever";
            combo.displayField = "name";
            // if next line is commented out the combo doesn't display any items
            combo.setStore(store);
    
            Button btn = new Button("Fill combo", new SelectionListener() {
                public void componentSelected(ComponentEvent ce) {
                    Store s = combo.getStore();
                    // following command doesn't work, "dummy" item still visible in list
                    s.removeAll();
                    s.add(new Record(new MyModel("John1", 30)));
                    s.add(new Record(new MyModel("John2", 31)));
                    s.add(new Record(new MyModel("John3", 32)));
                    s.add(new Record(new MyModel("John4", 33)));
    
                    combo.recalculate(); // no effect
                }
            });
            
            viewport.add(combo);
            viewport.add(btn);
            viewport.layout(true);
            RootPanel.get().add(viewport);
    
        }
    }

  2. #2
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,241
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    There are some issues I am working on to support mods to the store after the combo is rendered. I will post back when they are done, which will be before beta2.

  3. #3
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,241
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    The height of the drop down list was not being reset after first being displayed. This was causing the problem when not having a single record and the problems when adding records dynamically.

    removeAll was not clearing any existing items.

    All the fixes are in SVN.

  4. #4
    Ext User
    Join Date
    Apr 2008
    Posts
    18
    Vote Rating
    0
    baluba is on a distinguished road

      0  

    Default


    Hello Darrel,

    I just tried the beta2. The problem still remains:

    - removeAll doesn't remove any items
    - rendering a ComboBox without first setting the store throws an exception

    Code:
    public class ComboBoxProblem implements EntryPoint {
    
        class MyModel extends BaseModel {
            MyModel() {
            }
    
            MyModel(String name, Integer age) {
                set("name", name);
                set("age", age);
            }
        }
    
    
        public void onModuleLoad() {
            Viewport viewport = new Viewport();
            viewport.setLayout(new FlowLayout());
    
            Store store = new Store();
            // if next line is commented out the ComboBox throws exception
            store.add(new MyModel("dummy", 5));
    
            final ComboBox combo = new ComboBox();
            combo.setWidth(100);
            combo.setFieldLabel("Whatever");
            combo.setDisplayField("name");
            // if next line is commented out the ComboBox throws exception
            combo.setStore(store);
    
            Button btn = new Button("Fill combo", new SelectionListener() {
                public void componentSelected(ComponentEvent ce) {
                    Store s = combo.getStore();
                    // following command doesn't work, "dummy" item remains in list
                    // and it's not selectable
                    s.removeAll();
    
                    s.add(new MyModel("John1", 30));
                    s.add(new MyModel("John2", 31));
                    s.add(new MyModel("John3", 32));
                    s.add(new MyModel("John4", 33));
    
                }
            });
    
            viewport.add(combo);
            viewport.add(btn);
            viewport.layout(true);
            RootPanel.get().add(viewport);
        }
    }

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