1. #1
    Sencha User
    Join Date
    Oct 2010
    Posts
    159
    Vote Rating
    0
    mdavis6890 is on a distinguished road

      0  

    Default ArrayCombo

    ArrayCombo


    I'm trying to get a ComboBox with an ArrayStore working properly.

    Can somebody give me a quick example of something from Ext4?

    Thanks,
    Michael

  2. #2
    Sencha User renku's Avatar
    Join Date
    Feb 2009
    Location
    Estonia
    Posts
    437
    Vote Rating
    17
    renku is a splendid one to behold renku is a splendid one to behold renku is a splendid one to behold renku is a splendid one to behold renku is a splendid one to behold renku is a splendid one to behold renku is a splendid one to behold

      0  

    Default


    Something like this should work:

    Code:
      new Ext.form.ComboBox({
        store: Ext.create('Ext.data.ArrayStore', {
          fields: [ 'email' ],
          data: [
            ['test@example.com'],
            ['someone@example.com'],
            ['someone-else@example.com']
          ]
        }),
        displayField: 'email',
        fieldLabel: 'Send To',
        queryMode: 'local',
        name: 'to',
        renderTo: document.body
      });
    Interestingly when I tried to get this working with using dynamic class loading (not using ext-all-debug.js) it wasn't enough when I specified:

    Code:
    Ext.require([
      'Ext.form.ComboBox',
      'Ext.data.ArrayStore'
    ]);
    Instead I had to add several more:

    Code:
    Ext.require([
      'Ext.form.ComboBox',
      'Ext.data.ArrayStore'
      "Ext.data.AjaxProxy",
      "Ext.data.JsonReader",
      "Ext.data.JsonWriter",
      "Ext.data.ArrayReader"
    ]);
    Why do I need AjaxProxy when creating ArrayStore?

  3. #3
    Sencha User
    Join Date
    Oct 2010
    Posts
    159
    Vote Rating
    0
    mdavis6890 is on a distinguished road

      0  

    Default


    There seems to be a bug, but I'm not exactly sure. Try using an int for the value field:

    PHP Code:

    new Ext.form.ComboBox({
        
    storeExt.create('Ext.data.ArrayStore', {
          
    fields: [ 'email' ],
          
    data: [
            [
    1],
            [
    2],
            [
    3]
          ]
        }),
        
    displayField'email',
        
    fieldLabel'Send To',
        
    queryMode'local',
        
    name'to',
        
    renderTodocument.body
      
    }); 
    I made this change and it seems to fix the problem:


    PHP Code:

        createPicker
    : function() {
            var 
    me this,
            
    picker,
            
    opts = {
                
    selModel: {
                
    modeme.multiSelect 'SIMPLE' 'SINGLE'
                
    },
                
    floatingtrue,
                
    hiddentrue,
                
    ownerCtthis.ownerCt,
                
    renderTodocument.body,
                
    storeme.store,
                
    displayFieldme.displayField,
                
    widthme.listWidth,
                
    maxHeightme.listMaxHeight,
                
    loadingTextme.listLoadingText,
                
    emptyTextme.listEmptyText
            
    };
        
            if (
    me.getInnerTpl) {
            
    opts.getInnerTpl me.getInnerTpl;
            }
        
            
    picker = new Ext.view.BoundList(opts);
        
            
    // Ensure the selected Models display as selected.
            
    if (me.value) {
            
    //me.select(me.value.split(me.delimiter)); Breaks if value is int.
            
    me.select(me.value);
            }
        
            
    me.mon(picker.getSelectionModel(), {
            
    selectionChangeme.onListSelectionChange,
            
    scopeme
            
    });
        
            return 
    picker;
        }, 

  4. #4
    Sencha User shaun.trennery's Avatar
    Join Date
    Apr 2007
    Posts
    12
    Vote Rating
    0
    shaun.trennery is on a distinguished road

      0  

    Default //me.select(me.value.split(me.delimiter));

    //me.select(me.value.split(me.delimiter));


    Replacing this line as per the comment above did the trick.

  5. #5
    Sencha User
    Join Date
    Oct 2010
    Posts
    159
    Vote Rating
    0
    mdavis6890 is on a distinguished road

      0  

    Default


    I don't know enough to figure whether this is a brutish hack or an elegant bug fix.

    Why was the value being split in the first place?

    Michael

  6. #6
    Touch Premium Member
    Join Date
    Feb 2011
    Posts
    15
    Vote Rating
    1
    hulstein is on a distinguished road

      0  

    Default


    So probably cleaner to do it like this:


    Code:
            // Ensure the selected Models display as selected.
            if (me.value) {
                if ( typeof( me.value ) == 'number' ) {
                	me.select(me.value);
                } else {
                	me.select(me.value.split(me.delimiter));
                }
            }

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..."