/*
 * Ext JS Library 1.1 RC 1
 * Copyright(c) 2006-2007, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://www.extjs.com/license
 */

Ext.onReady(function(){

    // create the Data Store
    var ds = new Ext.data.Store({
        // load using HTTP
        proxy: new Ext.data.HttpProxy({url: 'socios.xml'}), 
        // the return will be XML, so lets set up a reader
        reader: new Ext.data.XmlReader({
               // records will have an "Socio" tag
               record: 'Socio',
               //id: 'ASIN',
               totalRecords: '@total'
           }, [
               // set up the fields mapping into the xml doc
               // The first needs mapping, the others are very basic
               {name: 'Apellidos', mapping: 'Apellidos'},
               'Nombre', 'Clasificacion'
           ])
    });

    var cm = new Ext.grid.ColumnModel([
	    {header: "Apellidos", width: 220, dataIndex: 'Apellidos'}, 			//admite '50%' 
		{header: "Nombre", width: 100, dataIndex: 'Nombre'},
		{header: "Clasificación", width: 240, dataIndex: 'Clasificacion'}//, último sin coma!!!
		//{header: "Product Group", width: 100, dataIndex: 'ProductGroup'}
	]);
    cm.defaultSortable = true;

    // create the grid
    var grid = new Ext.grid.Grid('example-grid', {
        ds: ds,
        cm: cm
    });
    grid.render();

    ds.load();
});
