2
votes

My new in extjs and working on ExtJS 3.2.

In that my data is not loading but if comment data column is displaying can anyone please help me.

My code is

{
    xtype: 'panel',
    title: "Search Result",
    items: [{
        xtype: 'grid',
        store: new Ext.data.Store({
            autoDestroy: true,
            fields: ['Name', 'Roll', 'Class'],
            root: 'records',
            // proxy: proxy,
            data: [{
                Name: false,
                Roll: 'a',
                Class: 20
            }, {
                Name: true,
                Roll: 'b',
                Class: 25
            }]
        }),
        columns: [{
            text: 'Name',
            id: 'company',
            header: 'Name',
            width: 130,
            sortable: false,
            hideable: false,
            dataIndex: 'Name'
        }, {
            text: 'Roll',
            width: 130,
            header: 'Name',
            dataIndex: 'Roll',
            hidden: false
        }, {
            text: 'Class',
            width: 130,
            header: 'Class',
            dataIndex: 'Class',
            hidden: false
        }]
    }]

}

Inside panel I am taking grid.

Can anybody please help me.?

2

2 Answers

1
votes

I am writing data outside the scope and now its working fine.

My complete code is.

var myData = [       
    ['FFPE Slide',2,'eSample'],
    ['Plasma',2,'eSample'],
    ['Whole Blood',2,'eSample']  ];   

// create the data store
var store = new Ext.data.ArrayStore({
    fields: [
       {name: 'stype'},
       {name: 'scnt'},
       {name: 'src'}

    ]
});
store.loadData(myData);  
var grid = new Ext.grid.GridPanel({
    store: store,
    columns: [
        {id:'company',header: "Sample Type", width: 75, sortable: true, dataIndex: 'stype'},
        {header: "Subjects Count", width: 75, sortable: true,  dataIndex: 'scnt'},
        {header: "Source", width: 75, sortable: true, dataIndex: 'src'}
    ],
    stripeRows: true,
    autoExpandColumn: 'company',
    height:150,
    width:150,
    title:'Detailed Counts'
});

This is working fine.

0
votes

Remove the root config (root:'records') in the store.. or try to add records property to the data object. Remove the reader as well