我的JS代码如下:
var store = Ext.create('Ext.data.ArrayStore', {
fields: [
{ name: 'company' },
{ name: 'price', type: 'float' },
{ name: 'change', type: 'float' },
{ name: 'pctChange', type: 'float' },
{ name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia' }],
proxy: new Ext.data.HttpProxy({
url: 'Default.aspx'
}),
reader: new Ext.data.ArrayReader({}, [
{ name: 'company' },
{ name: 'price', type: 'float' },
{ name: 'change', type: 'float' },
{ name: 'pctChange', type: 'float' },
{ name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}])
});
var grid = Ext.create('Ext.grid.Panel', {
store: store,
stateful: true,
stateId: 'stateGrid',
columns: [
{
text: 'Company',
flex: 1,
sortable: false,
dataIndex: 'company'
},
{
text: 'Price',
width: 75,
sortable: true,
renderer: 'usMoney',
dataIndex: 'price'
},
{
text: 'Change',
width: 75,
sortable: true,
renderer: change,
dataIndex: 'change'
},
{
text: '% Change',
width: 75,
sortable: true,
renderer: pctChange,
dataIndex: 'pctChange'