Static data grid
<html>
<head>
<title>Hello World Window</title>
<link rel="stylesheet" type="text/css" href="ext-3.0.0/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-3.0.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-3.0.0/ext-all.js"></script>
</head>
<script type="text/javascript">
Ext.onReady(function() {
var arrayData = [
['J', 'MD'],
['A', 'VA'],
['S', 'DC'],
['M', 'DE'],
['B', 'NJ'],
['N', 'CA']
];
var store = new Ext.data.ArrayStore({
data : arrayData,
fields : ['fullName', 'state']
});
var cm = new Ext.grid.ColumnModel([
{
header : 'Full Name',
sortable : true,
dataIndex : 'fullName'
},
{
header : 'State',
dataIndex : 'state'
}
]);
var gridView = new Ext.grid.GridView();
var selModel = new Ext.grid.RowSelectionModel({
singleSelect : true
})
var grid = new Ext.grid.GridPanel({
title : 'Our first grid',
renderTo : Ext.getBody(),
autoHeight : true,
width : 250,
store : store,
view : gridView,
colModel : cm,
selModel : selModel
});
});
</script>
<body>
</body>
</html>
Related examples in the same category