Ext.onReady(function(){
var dataStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url: 'sampledata-sheldon.xml'}),
reader: new Ext.data.XmlReader({
record: 'Item',
id: 'ASIN'
}, [
'Author', 'Title', 'Manufacturer', 'ProductGroup'
])
});
var colModel = new Ext.grid.ColumnModel([
{header: "Author", width: 120, dataIndex: 'Author'},
{header: "Title", width: 180, dataIndex: 'Title'},
{header: "Manufacturer", width: 115, dataIndex: 'Manufacturer'},
{header: "Product Group", width: 100, dataIndex: 'ProductGroup'}
]);
var grid = new Ext.grid.GridPanel({
store: dataStore,
cm: colModel,
viewConfig: {
forceFit:true
},
width: 600,
height: 300,
collapsible: true,
animCollapse: false,
title: 'test',
iconCls: 'icon-grid',
renderTo: document.body
});
});
<?xml version="1.0" encoding="UTF-8"?>
<Items>
<Request>
<IsValid>True</IsValid>
<ItemSearchRequest>
<Author>Sidney Sheldon</Author>
<SearchIndex>Books</SearchIndex>
</ItemSearchRequest>
</Request>
<TotalResults>203</TotalResults>
<TotalPages>21</TotalPages>
<Item>
<ASIN>0446357448</ASIN>
<DetailPageURL>http://www.amazon.com/gp/<;/DetailPageURL>
<ItemAttributes>
<Author>Sidney Sheldon</Author>
<Title>Bloodline</Title>
<Manufacturer>Warner Books</Manufacturer>
<ProductGroup>Book</ProductGroup>
</ItemAttributes>
</Item>
</Items>
</ItemSearchResponse>