user2477311
user2477311

Reputation: 155

EXTJS4: Combobox Store in View throws error

I have a normal Combobox in my view, and I want to load the store, but then I get an error in my Firebug: TypeError: reader.read is not a function result = reader.read(me.extractResponseData(response));

The part in my view:

{
        xtype: 'combobox',
        id:'newsletter_template',
        fields: ['groupValue','groupText'],
        name:'template',
        editable:false,
        valueField: 'groupValue',
        displayField: 'groupText',
        allowBlank: false,
        fieldLabel: 'Template',
        anchor: '100%',
        emptyText: 'Choose Template',
        store: Ext.create('Ext.data.ArrayStore', {
            model: 'news',
            controller: 'news',
            proxy: {
                type: 'ajax',
                url: 'bin/news/ajax.php',
                reader: {
                    type: 'json',
                    root: 'results'
                },
                extraParams:{
                    action:'getNewsTemplates'
                }
            },
            callback: function(records, operation, success) {
            // do something after the load finishes
            },
            autoLoad: false
        })

    }

Has anyone an idea? THANKS A LOT!!!

Upvotes: 0

Views: 167

Answers (1)

Reimius
Reimius

Reputation: 5712

Try changing store: Ext.create('Ext.data.ArrayStore', { to store: Ext.create('Ext.data.Store', {

The problem is that you are using an ArrayStore which is basically a regular store with an array reader already defined, then you are defining a json reader in it which doesn't make any sense.

Upvotes: 1

Related Questions