Question

I'm having strange problem with my store inside ExtJS. My ASP.NET MVC3 controller returns JSON:

enter image description here

My store:

Ext.define('MyApp.store.Users', {
    extend: 'Ext.data.Store',
    config: {
        // I know the model works
        model: 'MyApp.model.User',
        storeId: 'Users',
        autoLoad: true,
        proxy: {
            type: 'ajax',
            url: 'users/read',
            reader: {
                type: 'json',
                root: 'users'
                // also tried this
                rootProperty: 'users'
            }
        }
    }
});

Now, when I connect this store to the grid inside ExtJS 4.2.1, the grid shows TWO rows but without data. When I console.log(store) I see the data only inside raw property, not inside data property.

Does anyone know what's the problem? Why isn't there any mapping? The grid's dataIndex is also the same as Models fields (I've done this a thousand times with PHP, I don't know where is the problem here.)

One more thing I've tried. I've tried renderer: function(value) { console.log(value); } inside grid's columns and I was just getting undefined.

Edit: this is how the JSON actually looks like:

enter image description here

Was it helpful?

Solution 2

SENCHA what the hell?! Sencha Touch 2 always says put everything in config? Now when I do that in ExtJS, everything breaks?

I removed everything from config: {} and now it works great.

OTHER TIPS

Try using root: 'users' not rootProperty. If not specified root defaults to ''.

Sencha Docs

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top