/*
 * Ext JS Library 2.2.1
 * Copyright(c) 2006-2009, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */

Ext.onReady(function(){

    // create the Data Store
    var store = new Ext.data.Store({
        // load using HTTP
        url: 'news.xml',

        // the return will be XML, so lets set up a reader
        reader: new Ext.data.XmlReader({
               // records will have an "Item" tag
               record: 'Article',
               id: 'ASIN',
               totalRecords: '@total'
           }, [
               // set up the fields mapping into the xml doc
               // The first needs mapping, the others are very basic
               {name: 'PubDate', mapping: 'PubDate'},
               'Publication', 'Title'
			])

	});

    // create the grid
    var grid = new Ext.grid.GridPanel({
        store: store,
        columns: [
            {header: "Date", width: 60, dataIndex: 'PubDate', sortable: true},
            {header: "Publication", width: 150, dataIndex: 'Publication', sortable: true},
			{header: "Title", width: 278, dataIndex: 'Title', sortable: true}
        ],

		renderTo:'news-grid',
		width: 488,
        height: 1100

    });

    store.load();
});
