1

次のJSONがあり、バックエンドから受信しています。

{
    "scripts": [
        "actions/rss",
        "actions/db/initDb",
        "actions/utils/MyFile",
        "actions/utils/Valid"
    ],
    "success": true
}

JSONストア:

    this.store = new Ext.data.JsonStore({

        proxy: new Ext.data.HttpProxy({
            url: "http://www.example.com",
            method: 'POST'
        }),
        baseParams: {
            appId: "hsvdvndcnwvwbasxcwyc"               
        },
        root: 'scripts',
        fields: ['value']

    });

コンボボックス:

    this.aField = new Ext.form.ComboBox({
        fieldLabel      : 'action',
        name        : 'actionName',
        anchor      : "95%",                     
        allowBlank      : false,
        emptyText       : "Select action",            

    triggerAction   : 'all',
    lazyRender      : true,
    mode            : 'remote',
        store           : this.store,
    valueField      : 'value',
    displayField    : 'value'
    });     

だから、私はバックエンドから応答を受け取っています、それは大丈夫です。しかし、私のコンボボックスのドロップダウンリストは空です(JSONのアイテム数に等しい10行の空の行が表示されます)。問題がJSONストアのfieldsプロパティにあることを知っています。しかし、それを機能させるために私はそこに何を入れるべきですか?

ありがとう!

4

1 に答える 1

1

サイドリーダーオブジェクトにroot:'scripts'を入れて「JSONstore:」コードを変更し、タイプも追加して、プロキシにリーダーを追加してみてください。

したがって、JSONストア:コードは次のようになります

this.store = new Ext.data.JsonStore({
   proxy: new Ext.data.HttpProxy({
        url: "http://www.example.com",
        method: 'POST',
        reader: {            
                  type:'json',
                  root: 'scripts'
        }
    }),
    baseParams: {
        appId: "hsvdvndcnwvwbasxcwyc"               
    },

    fields: ['value']
});
于 2013-01-24T16:48:57.713 に答える