1. #1
    Sencha User
    Join Date
    Nov 2010
    Posts
    45
    Vote Rating
    0
    nil5286 is on a distinguished road

      0  

    Default Answered: Load the Combobox with the Json File

    Answered: Load the Combobox with the Json File


    Hi,

    I've a problem loading combobox from a Json file Below is the exception i get

    uncaught exception: Either a valid store, or a HTML select to transform, must be configured on the combo.

    Code:
            Ext.define('FieldsetDynamicControls', {
                extend: 'Ext.data.Model'
        , fields: ['name', 'label', 'config']
            });
    
    
            var userStore;
            Ext.require('Ext.data.Store');
            Ext.onReady(function () {
    
    
                Ext.create('Ext.form.field.ComboBox', {
                    fieldLabel: 'Select a single state',
                    renderTo: Ext.getBody(),
                    displayField: 'name',
                    valueField: 'label',
                    width: 320,
                    labelWidth: 130,
                    store: userStore,
                    queryMode: 'local',
                    typeAhead: true
                });
    
    
                userStore = Ext.create('Ext.data.Store', {
                    model: 'FieldsetDynamicControls',
                    autoLoad: true,
                    proxy: {
                        type: 'ajax',
                        //the store will get the content from the .json file
                        url: '/controllist.json',
                        reader: {
                            type: 'json',
                            root: 'list'
                        },
                        writer: {
                            type: 'json'
                        }
                    }
    
    
                });
            });

    My Json file is as below:

    Code:
    {list:[
        { label: 'Display Name', name: 'displayName' }
        , { label: 'First Name', name: 'givenName' }
        , { label: 'Middle Name', name: 'initials' }
        , { label: 'Last Name', name: 'sn' }
        , { 
            label: 'Checkbox'
            , name: 'checkbox'
            , config: { xtype: 'checkbox' }
        }
        , { 
            label: 'Combo'
            , name: 'combo'
            , config: { xtype: 'combo' }
        }
        , { 
            label: 'Number'
            , name: 'number'
            , config: { xtype: 'numberfield' }
        }
        , { 
            label: 'Date'
            , name: 'date'
            , config: { xtype: 'datefield' }
        }
    ]
    }

    Any help is appreciated. I am using
    extjs 4.0.2a.

    Thanks

  2. you should create the store before you create the combobox. userStore is undefined when you use it in creating the combobox.

  3. #2
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,084
    Answers
    112
    Vote Rating
    95
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      0  

    Default


    you should create the store before you create the combobox. userStore is undefined when you use it in creating the combobox.

  4. #3
    Sencha User
    Join Date
    Nov 2010
    Posts
    45
    Vote Rating
    0
    nil5286 is on a distinguished road

      0  

    Default


    Thanx very much , ya i just realized that and it fixed my problem.

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