Skip to content

Instantly share code, notes, and snippets.

@filiptepper
Created May 16, 2011 12:33
Show Gist options
  • Save filiptepper/974370 to your computer and use it in GitHub Desktop.
Save filiptepper/974370 to your computer and use it in GitHub Desktop.
Ext.require(['Ext.grid.*', 'Ext.data.*', 'Ext.util.*', 'Ext.state.*', 'Ext.window.*']);
Ext.onReady(function() {
var myData = [
['3m Co']];
var store = Ext.create('Ext.data.ArrayStore', {
fields: [
{
name: 'company'
},
],
data: myData
});
var columns = [
{
text: 'Company',
flex: 1,
sortable: false,
dataIndex: 'company'
}
];
var grid = Ext.create('Ext.grid.Panel', {
store: new Ext.data.ArrayStore(),
stateful: true,
stateId: 'stateGrid',
height: 350,
columns: [],
width: 600,
title: 'Array Grid',
viewConfig: {
stripeRows: true
}
});
new Ext.Window({
items: [
{
xtype: 'panel',
border: false,
layout: {
type: 'card'
},
items: [
grid
]
}
],
renderTo: Ext.getBody()
}).show();
setTimeout(function() {
grid.reconfigure(store, columns);
}, 1000);
});
Ext.require(['Ext.grid.*', 'Ext.data.*', 'Ext.util.*', 'Ext.state.*', 'Ext.window.*']);
Ext.onReady(function() {
var myData = [
['3m Co'],
['Alcoa Inc'],
['Altria Group Inc'],
['American Express Company'],
['American International Group, Inc.'],
['AT&T Inc.'],
['Boeing Co.'],
['Caterpillar Inc.'],
['Citigroup, Inc.'],
['E.I. du Pont de Nemours and Company'],
['Exxon Mobil Corp'],
['General Electric Company'],
['General Motors Corporation'],
['Hewlett-Packard Co.'],
['Honeywell Intl Inc'],
['Intel Corporation'],
['International Business Machines'],
['Johnson & Johnson'],
['JP Morgan & Chase & Co'],
['McDonald\'s Corporation'],
['Merck & Co., Inc.'],
['Microsoft Corporation'],
['Pfizer Inc'],
['The Coca-Cola Company'],
['The Home Depot, Inc.'],
['The Procter & Gamble Company'],
['United Technologies Corporation'],
['Verizon Communications'],
['Wal-Mart Stores, Inc.']
];
var store = Ext.create('Ext.data.ArrayStore', {
fields: [
{
name: 'company'
},
],
data: myData
});
var columns = [
{
text: 'Company',
flex: 1,
sortable: false,
dataIndex: 'company'
}
];
var grid = Ext.create('Ext.grid.Panel', {
store: new Ext.data.ArrayStore(),
stateful: true,
stateId: 'stateGrid',
height: 350,
columns: [],
width: 600,
title: 'Array Grid',
viewConfig: {
stripeRows: true
}
});
new Ext.Window({
items: [
{
xtype: 'panel',
border: false,
layout: {
type: 'card'
},
items: [
grid
]
}
],
renderTo: Ext.getBody()
}).show();
setTimeout(function() {
grid.reconfigure(store, columns);
}, 1000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment