Extjs not displaying JSON data in grid

In store I am getting JSON response but still I am not able to load data in grid.

This is the JavaScript code:

prepare: function(){    
    // The store
    this.store = new Ext.ux.app.data.Store({
        directFn: Supplier.Hotelstock.Getcloseddate,
        fields: [ 'stock_days', 'stock_datefrom' ],
        autoLoad: false
    });

    var filters = {};
    var allowedFilters = ['supplier_id'];

    for(var i=0; i<allowedFilters.length; i++){
        if (!Ext.isEmpty(this[allowedFilters[i]])){
            filters[allowedFilters[i]] = this[allowedFilters[i]];
        }
    }

    this.store.setBaseParam('filter', filters);
    this.store.load();

    //alert(this.store.data.first());
    // The grid
    this.grid = new Ext.ux.app.page.Grid({
        store: this.store,
        border: false,
        autoResizeColumn: 1,
        region: 'center',
        columns: [
            {
                dataIndex: 'stock_days',
                header: 'Days',
                width: 40
            },
            {
                dataIndex: 'stock_datefrom',
                header: 'Closed Date',
                width: 200,
                sortable: true
            }
        ]
    });
    this.setItems([this.grid]);
}

This is the response:

{
    "tid": 9,
    "type": "rpc",
    "action": "Supplier_Hotelstock",
    "method": "Getcloseddate",
    "result": {
        "results": 3,
        "rows": [{
            "stock_days": "Tue",
            "stock_datefrom": "2013-08-06"
        }, {
            "stock_days": "Wed",
            "stock_datefrom": "2013-08-07"
        }, {
            "stock_days": "Fri",
            "stock_datefrom": "2013-08-16"
        }],
        "start": false,
        "pageSize": false,
        "metaData": {
            "totalProperty": "results",
            "startProperty": "start",
            "root": "rows",
            "fields": [{
                "name": "stock_days",
                "type": "string"
            }, {
                "name": "stock_datefrom",
                "type": "string"
            }]
        }
    }
}

Answers


You don't load youre data with:

Ext.create('Ext.data.Store', {...

?

Where do you put your parameters for the store? I Use a store with proxy type memory, and i have the same problem of loading data. If you want to gice a complete call to the methods used for the store than have a look at the Sencha documentation.


Need Your Help

Choose a pair from two arrays

algorithm

Given 2 arrays A and B of length n and m respectively.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.