var sUrl = '/wp-content/uploads/tables/TCgpcars.xml';
Ext.onReady(function(){
var Person = Ext.data.Record.create([
{name: 'Pos'},
{name: 'Nro'},
{name: 'Piloto'},
{name: 'Marca'},
{name: 'Puntos'}
]);
var reader = new Ext.data.XmlReader({
record: 'ChampData',
totalRecords: 'TotalRecord',
totalProperty: 'TotalRecord',
id: 'Pos',
}, Person);
//creates the Ext.data.Store
var store = new Ext.data.Store({
url: sUrl,
totalProperty: 'total',
reader: reader //setting the reader
});
var pager = new Ext.PagingToolbar({
store: store, // <--grid and PagingToolbar using same store (required)
displayInfo: true,
displayMsg: '{0} - {1} of {2} Cities',
emptyMsg: 'No cities to display',
pageSize: 6
});
// create the grid
var grid = new Ext.grid.GridPanel({
store: store, //le asignamos la fuente de datos
columns: [ //creamos las columnas
{header: "Pos.", width: 38, dataIndex: 'Pos', type: 'string'},
{header: "Nro", width: 35, dataIndex: 'Nro', type: 'string'},
{header: "Piloto", width: 100, dataIndex: 'Piloto', type: 'string'},
{header: "Marca", width: 60, dataIndex: 'Marca', type: 'string'},
{header: "Ptos", width: 40, dataIndex: 'Puntos', type: 'int'}
],
renderTo:'gridpanel',
width:540,
height:200,
bbar: pager, // <--- Barra de paginación
border: false, //le quitamos el borde
stripeRows: true //le asignamos rayas a las filas
});
store.load();
});
// create the grid
var grid = new Ext.grid.GridPanel({
store: store, //le asignamos la fuente de datos
renderer: pager,
columns: [ //creamos las columnas
{header: "Pos.", width: 38, dataIndex: 'Pos', type: 'string'},
{header: "Nro", width: 35, dataIndex: 'Nro', type: 'string'},
{header: "Piloto", width: 100, dataIndex: 'Piloto', type: 'string'},
{header: "Marca", width: 60, dataIndex: 'Marca', type: 'string'},
{header: "Ptos", width: 40, dataIndex: 'Puntos', type: 'int'}
],
renderTo:'gridpanel',
width:540,
height:200,
bbar: pager, // <--- Barra de paginación
border: false, //le quitamos el borde
stripeRows: true //le asignamos rayas a las filas
});
It looks like you're new here. If you want to get involved, click one of these buttons!
The content of this site is copyrighted by Quizzpot.com, it is prohibited to publish our tutorials on other blogs, magazines or any other media without prior permission.
Copyright © 2012 Quizzpot.
Our visitors are mostly developers and Web designers, advertise with us, you only need to contact us .