Skip to content

Instantly share code, notes, and snippets.

@pphetra
Last active December 19, 2015 01:38
Show Gist options
  • Select an option

  • Save pphetra/5877154 to your computer and use it in GitHub Desktop.

Select an option

Save pphetra/5877154 to your computer and use it in GitHub Desktop.
car model & store
Ext.define('Car', {
extend: 'Ext.data.Model',
fields: [
'id',
'brand',
'model',
{name: 'price', type: 'float'}
]
});
var carStore = Ext.create('Ext.data.JsonStore', {
model: 'Car',
proxy: {
type: 'rest',
url: '/sagi/service/car',
reader: {
type: 'json',
root: 'data'
}
}
});
var grid = Ext.create('Ext.grid.Panel', {
store: carStore,
columns: [
{
header: 'Model',
dataIndex: 'model'
},
{
header: 'brand',
dataIndex: 'brand'
},
{
header: 'price',
dataIndex: 'price'
}
],
floating: true,
width: 400, height: 400
})
grid.show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment