1. #1
    Ext User
    Join Date
    Mar 2010
    Posts
    1
    Vote Rating
    0
    skinssay is on a distinguished road

      0  

    Default Populate a combobox using DirectStore

    Populate a combobox using DirectStore


    I'm having issues while populating a combobox using DirectStore, the combobox is as follow:
    Code:
    this.Combo = new Ext.form.ComboBox({
                fieldLabel: "Name",
                editable: false,
                triggerAction: 'all',
                mode: 'remote',
                store: new Ext.data.DirectStore({
                    reader: new Ext.data.JsonReader({
                        successProperty: 'success',
                        idProperty: 'name',
                        root: 'data',
                        fields: [ 'name' ]
                    }),
                    autoLoad: true,
                    api: { read: SS.MyApi.getNames }
                }),
                valueField: 'name',
                displayField: 'name'
            });
    The returned json is:
    Code:
    [{"type":"rpc","tid":7,"action":"MyApi","method":"getNames","result":{"success":true,"data":{"name":["name1","name2","name3"]}}}]
    And the c# code that generates the json
    Code:
    [DirectMethod]
    public JObject getNames()
    {
            List<string> names = new List<string>();
    		names.Add("name1");
    		names.Add("name2");
    		names.Add("name3");
    			
    		JObject data = new JObject();
    		data.Add(new JProperty("name", names));
            return  new JObject(
                                new JProperty("success", true),
                                new JProperty("data", data)
                        );
    }
    The combobox is showing only one entry with "name1,name2,name3". How can i have one entry per name?
    Thanks in advance!

  2. #2
    Ext User
    Join Date
    Apr 2010
    Posts
    1
    Vote Rating
    0
    yomama is on a distinguished road

      0  

    Default


    "data":{"name":["name1","name2","name3"]}
    Try change it to [{name:"name1"},{name:"name2"},{name:"name2"}]

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Location
    San Diego
    Posts
    1
    Vote Rating
    0
    bradychris1 is on a distinguished road

      0  

    Default


    Thanks for combobox coding in proper format ! thanks for sharing dude !

    Posted By Brady Chris,
    provillus | zquiet

Thread Participants: 2

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