Question

store, window and grid in this form. I am want insert to grid value from store. On picture I am pointed what data I am want insert

Model:

Ext.onReady(function () {Ext.define('RRD',{ extend: 'Ext.data.Model',
   fields: [
        'data'
    ]
});

Store:

var myStore = Ext.create('Ext.data.Store', {
    model: 'RRD',
    autoLoad: true,
    proxy: {
        type: 'ajax',
        url: '/price/books',
            reader: {
    type: 'json',
    root: 'data',
    successProperty: 'status' 
}
    }
});

Table and window:

    var myTable = Ext.create('Ext.grid.Panel', { store: myStore,
    columns: [
        { text : 'Value', sortable : true, dataIndex: 'data', flex: 0, width: 100 },
    ],
    height: 900,
    width: 300,
    title: 'Data'
});

var win = Ext.create('Ext.Window', { width: 800,
    height: 600,
    minHeight: 400,
    minWidth: 550,
    hidden: false,
    maximizable: true,
    title: 'RRD Table',
    renderTo: Ext.getBody(),
    layout: 'fit',
    items: [myTable]
});
});

enter image description here

How insert this date to grid?

Was it helpful?

Solution

your reader should take the nesting of your JSON into account:

reader: {
    type: 'json',
    root: 'rawData.data',
    successProperty: 'rawData.status' 
}

and you should send in your status either true or false

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