Skip to content

Instantly share code, notes, and snippets.

@pphetra
Created June 29, 2013 08:14
Show Gist options
  • Select an option

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

Select an option

Save pphetra/5890331 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Template</title>
<link rel="stylesheet" href="extjs/resources/css/ext-all.css">
<script src="extjs/ext-all-debug.js"></script>
<script>
// รอให้ page load เสร้จแล้วค่อยทำงาน
Ext.onReady(function() {
Ext.define('Car', {
extend: 'Ext.data.Model',
fields: [
'id',
'chassieNo',
'engineNo',
'licenseNo'
]
});
var carStore = Ext.create('Ext.data.Store', {
model: 'Car',
proxy: {
type: 'memory'
}
});
var c1 = Ext.create('Car', {
id: 1,
chassieNo: '2434343',
engineNo: 'xx0dfdfd9000',
licenseNo: '1234'
});
var c2 = Ext.create('Car', {
id: 2,
chassieNo: '99909090',
engineNo: 'd00d9090',
licenseNo: '1120'
});
carStore.add(c1);
carStore.add(c2);
var grid = Ext.create('Ext.grid.Panel', {
store: carStore,
columns: [
{
header: 'Chassie',
dataIndex: 'chassieNo'
},
{
header: 'Engine',
dataIndex: 'engineNo'
}
]
});
var viewport = Ext.create('Ext.container.Viewport', {
layout: 'fit',
items: [
grid
]
})
});
</script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment