1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    1
    Vote Rating
    0
    trungle.it is on a distinguished road

      0  

    Default [MVC3] How to get JsonResult to Combobox

    [MVC3] How to get JsonResult to Combobox


    I have controller to get json:
    Code:
    public JsonResult GetJsonGroupAcc()
            {
                DataTable dt = UtContext.service.MainDb.SelectObjects("abgps_accounts_groups");
                string json = "[";
                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; ++i)
                    {
                        json += "{id:\"" + dt.Rows[i]["id"].ToString() + "\",";
                        json += "name:\"" + dt.Rows[i]["name"].ToString() + "\",";
                        json += "active:\"" + dt.Rows[i]["active"].ToString() + "\"},";
                    }
                }
                json += "]";
                return Json(json);
            }
    My Json like this:
    "[{id:\"21\",name:\"group 1\",active:\"1\"},{id:\"22\",name:\"group 2\",active:\"1\"},]"
    How can I get this json to load to combobox:
    Code:
    fieldLabel: 'Group',
                    xtype: "combobox",
                    id: 'detailacc_group',
                    store: Ext.data.JsonStore({
                        fields: ['id', 'name'],
                        proxy: {
                            url: '/AccountGroup/GetJsonGroupAcc',
                            type: 'ajax'
                        },
                        //reader: { type: 'json' },
                        type: 'json',
                        QueryMode: "local"
                    }),
                    displayField: "name",
                    valueField: "id",
                    value: group_id,
                    editable: false,
                    queryMode: 'local',
                    anchor: '100%' // anchor width by percentage

  2. #2
    Sencha Premium Member vadimv's Avatar
    Join Date
    Sep 2010
    Location
    Chisinau, Moldova
    Posts
    642
    Vote Rating
    25
    vadimv will become famous soon enough vadimv will become famous soon enough

      0  

    Default


    1. Your json doesn't have a root. Should be: {data:[]}, more you find here:http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.JsonStore
    2. On combo change queryMode to 'remote'.
    3. Work with documentation: http://docs.sencha.com/ext-js/4-1/#!...data.JsonStore

Thread Participants: 1

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