Code:
var sitesData = { "records": [{
id: "12893",
lat: "47.3004",
lng: "-122.225",
type: "2~8",
listTypes: "LUST~UST",
siteName: "CENEX HARVEST STATES COOPERATIVES",
riskLevel: "2",
street: "238 8TH SE",
city: "AUBURN",
state: "WA",
ZIP: "98002",
siteids: "WALUSTIS-2487~WAUSTLIS-2487"
}],
success: true,
totalCount: 1
};
Ext.define('Record', {
extend: 'Ext.data.Model',
fields: [
{name: "id", type: 'string'},
{name: "lat", type: 'float'},
{name: "lng", type: 'float'},
{name: "type", type: 'string'},
{name: "listTypes", type: 'string'},
{name: "siteName", type: 'string'},
{name: "riskLevel", type: 'string'},
{name: "street", type: 'string'},
{name: "city", type: 'string'},
{name: "state", type: 'string'},
{name: "ZIP", type: 'string'},
{name: "siteids", type: 'string'}
]
});
var gridStore = Ext.create('Ext.data.Store', {
autoLoad: true,
model: 'Record',
data: sitesData,
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'records',
totalProperty: 'totalCount'
}
}
});
this.activeDetailsGrid = {
xtype: 'grid',
store: gridStore,
selType: 'rowmodel',
autoScroll: true,
id: 'grid-panel',
columns: [
{ id: 'subjectHit', header: "S", width: 25, sortable: true, renderer: Layout.subjectHit, dataIndex: 'subjectHit' },
{ id: 'id', header: "Site ID", width: 50, sortable: true, dataIndex: 'id' },
{ text: "Site Name", width: 150, sortable: true, dataIndex: 'siteName' },
{ text: "Street", width: 150, sortable: true, dataIndex: 'street' },
{ text: "City", width: 75, sortable: true, dataIndex: 'city' },
{ text: "ST", width: 30, sortable: true, dataIndex: 'state' },
{ text: "ZIP", width: 50, sortable: true, dataIndex: 'ZIP' },
{ text: "Risk", width: 50, sortable: true, dataIndex: 'riskLevel', renderer: Layout.checkRiskLevel},
{ text: "Site Types", width: 125, sortable: true, dataIndex: 'listTypes' },
]
};
I am using the sitesData var is used to provide some data to create the grid. This is a holdover from v3.x - may not be needed in v4?