/*
 * yui-ext
 * Copyright(c) 2006, Jack Slocum.
 */

var XmlExample = {
    init : function(){
        var schema = {
            tagName: 'R1',
  		 fields: ['Player', 'Team', 'Att', 'AttPer', 'Yds', 'Avg', 'YdsPer', 'Tds', 'Lng', 'First', 'FirstPerc', 'O20', 'O18carry', 'O100yds', 'O90yds']
        };
        dataModel = new YAHOO.ext.grid.XMLDataModel(schema);
        
        // the DefaultColumnModel expects this blob to define columns. It can be extended to provide 
        // custom or reusable ColumnModels
        var colModel = new YAHOO.ext.grid.DefaultColumnModel([
			{header: "Player", width: 110, sortable: true}, 
			{header: "Team", width: 40, sortable: true}, 
			{header: "Att", width: 40, sortable: true}, 
			{header: "AttGame", width: 50, sortable: true}, 
			{header: "Yds", width: 50, sortable: true}, 
			{header: "Avg", width: 40, sortable: true}, 
			{header: "YdsGame", width: 70, sortable: true}, 
			{header: "TDs", width: 30, sortable: true}, 
			{header: "Lng", width: 40, sortable: true}, 
			{header: "First", width: 30, sortable: true},
			{header: "FirstPerc", width: 60, sortable: true}, 
			{header: "+20ydCarry", width: 60, sortable: true}, 
			{header: "+18Carry", width: 60, sortable: true}, 
			{header: "+100yds", width: 60, sortable: true}, 
			{header: "+90yds", width: 50, sortable: true} 
				]);
		
		// create the Grid
        var grid = new YAHOO.ext.grid.Grid('example-grid', dataModel, colModel);
        grid.autoWidth = true;
        grid.autoHeight = true;
        grid.render();

        dataModel.load('http://www.footballhangout.com/Stats/rbacks2007.xml');
    }
}
YAHOO.ext.EventManager.onDocumentReady(XmlExample.init, XmlExample, true);

