2

私は Extjs 4.1 を使用しています。Combobox のデータを読み込もうとしましたが、動作しません。私はjsonリーダーのルート/レコードに強い疑問を持っています。

データモデルとストアが定義され、

Ext.define('tagModel', {
    extend: 'Ext.data.Model',
    fields: [
        {name: 'id', type: 'string'},
        {name: 'name', type: 'string'}
    ]
});

var tagStore = new Ext.data.Store({
    model: 'tagModel',
    proxy: {
        type: 'ajax',
        url: '/ExtjsWebApp/webresources/question/loadTags',
        reader: {
            type: 'json',            
            record : 'rtnList'
        }       
    },
    listeners: {       
        load: function(store, records, options){
            alert("success " +records.length);
        }             
    },
    autoLoad: true
});

ComboBox は次のように定義されています。

 {
            itemId: 'search_tag_fld',
            fieldLabel: 'Tag',
            xtype: 'combobox',
            displayField: 'name',  
            valueField: 'id',
            store: tagStore,
            queryMode: 'remote',
            multiSelect: true,
            anchor: '100%',           
            labelHeight: 300            
        }

安らかなWebサービスがこのようにデータを返すと確信しています

{"rtnList":[{"id":1,"name":"Java","active":"true"},{"id":2,"name":"J2EE","active":"true"},{"id":3,"name":"JMS","active":"true"},{"id":4,"name":"Design","active":"true"},{"id":5,"name":"SOA","active":"true"}],"successMsg":"success","errorMsg":"","time":"09/21/2013 18:34:55","sessionId":null,"userId":null}
4

1 に答える 1

0

リーダーで、「レコード」を「ルート」に変更します。これは、現在のセットアップがうまく機能することを示すフィドルです: https://fiddle.sencha.com/#fiddle/km

于 2013-09-22T00:54:00.590 に答える