PDA

View Full Version : Array store not mapping raw data to fields



ryammanuru
22 Dec 2011, 3:37 PM
Hi,

I just started on Ext JS and this is my first example with Arraystore. I have a servlet returning data as below.


[
["197_170",197,170,-18.4,-21.1,28,14.1,3.3,null,null,"1",null,5,7,"320.941_B",1]
]

When I associate grid with store, I can only see zeroes. Can anyone help me in resolving this?

Thanks,
--Rajani


Ext.define('customData', {
extend: 'Ext.data.Model',
fields: [{
name: 'deviceId',
type: 'string'
}, {
name: 'XId100um',
type: 'float'
}, {
name: 'YId100um',
type: 'float'
}, {
name: 'XPosMm',
type: 'float'
}, {
name: 'YPosMm',
type: 'float'
}, {
name: 'RMm',
type: 'float'
}, {
name: 'dieHeightMm',
type: 'float'
}, {
name: 'dieWidthMm',
type: 'float'
}, {
name: 'dieRow',
type: 'int'
}, {
name: 'dieCol',
type: 'int'
}, {
name: 'dieType',
type: 'string'
}, {
name: 'barSuffix',
type: 'string'
}, {
name: 'gridRow',
type: 'int'
}, {
name: 'gridCol',
type: 'int'
}, {
name: 'chipDesignId',
type: 'string'
}, {
name: 'sectionNum',
type: 'int'
}] );

var store = Ext.create('Ext.data.ArrayStore', {
proxy: {
type : 'ajax',
url: 'diegrid.action'
},
model: 'customInfo'
});

Ext.create('Ext.grid.Panel', {
title: 'customInfo',
store: store,
columns: [{
header: 'deviceId',
dataIndex: 'deviceId'
}, {
header: 'XId100um',
dataIndex: 'XId100um'
}, {
header: 'YId100um',
dataIndex: 'YId100um'
}, {
header: 'XPosMm',
dataIndex: 'XPosMm'
}, {
header: 'YPosMm',
dataIndex: 'YPosMm'
}, {
header: 'RMm',
dataIndex: 'RMm'
}, {
header: 'dieHeightMm',
dataIndex: 'dieHeightMm'
}, {
header: 'dieWidthMm',
dataIndex: 'dieWidthMm'
}, {
header: 'dieRow',
dataIndex: 'dieRow'
}, {
header: 'dieCol',
dataIndex: 'dieCol'
}, {
header: 'dieType',
dataIndex: 'dieType'
}, {
header: 'barSuffix',
dataIndex: 'barSuffix'
}, {
header: 'gridRow',
dataIndex: 'gridRow'
}, {
header: 'gridCol',
dataIndex: 'gridCol'
}, {
header: 'chipDesignId',
dataIndex: 'chipDesignId'
}, {
header: 'sectionNum',
dataIndex: 'sectionNum'
}],
height: 500,
renderTo: Ext.get('mygrid')
});

store.load();

skirtle
22 Dec 2011, 10:14 PM
Please use [CODE] tags when posting code.

You've defined a model called customData but on the store your model config is set to customInfo.