Code:
//array store
var store = new Ext.data.ArrayStore({
fields: [
{name: 'title', type: 'string'},
{name: 'hora', type: 'time'},
{name: 'ignicao', type: 'string'},
{name: 'vel', type: 'string'},
{name: 'ponto', type: 'string'},
{name: 'distancia', type: 'string'},
{name: 'online', type: 'string'},
{name: 'panico', type: 'string'},
{name: 'gps', type: 'string'},
{name: 'codigo', type: 'string'}
]
});
//gridpanel
new Ext.grid.GridPanel({
store: store, el:'topic-grid', id: 'panel',
columns: [
{header: "DESCRIÇÃO DO VEICULO", dataIndex: 'title', width: 100, sortable: true, id: 'title' },
{header: "HORÁRIO", dataIndex: 'hora', width: 100,sortable: true},
{header: "IGNIÇÃO",dataIndex: 'ignicao', width: 90,sortable: true},
{header: "VELOCIDADE",dataIndex: 'vel',width: 100,sortable: true},
{header: "PONTO MAIS PRÓXIMO",dataIndex: 'ponto',width: 380,sortable: true},
{header: "DISTÂNCIA DO PONTO",dataIndex: 'distancia',width: 310, sortable: true},
{header: "ON-LINE", dataIndex: 'online',width: 70,sortable: true},
{header: "PÂNICO",dataIndex: 'panico',width: 70,sortable: true},
{header: "GPS",dataIndex: 'gps',width: 50,sortable: true},
{id: 'codigo',header: "CÓDIGO",dataIndex: 'codigo',width: 50,sortable: true}
],
viewConfig: {
forceFit:true, enableRowBody:true, showPreview:true,
},
stripeRows: true,
autoExpandColumn: 'title',
height: 125,
width:screen.availWidth,
loadMask: true,
title: 'Array Grid',
stateful: true,
stateId: 'grid'
});
//event link treepanel
listeners: { click: function(e){
Ext.getCmp('dadosCarro').setSource({
Tipo : gmp[i].topo
,Marca : gmp[i].marca
,Modelo : gmp[i].modelo
,Cor : gmp[i].cor
,Placa : gmp[i].placa
,"Ano Fabricação" : gmp[i].ano_fabrica
,"Ano Modelo" : gmp[i].ano_modelo
});
var title = gmp[i].title; var hora = gmp[i].hora; var ignicao = gmp[i].ignicao; var vel = gmp[i].vel; var ponto = gmp[i].ponto;
var codigo = gmp[i].codigo; var gps = gmp[i].gps; var distancia = gmp[i].distancia; var panico = gmp[i].panico; var online = gmp[i].online;
myData2 = [ title, hora, ignicao, vel, ponto, distancia, online, panico, gps, codigo ];
alert(dump(myData2));
i++;
Ext.getCmp('panel').getStore().loadData(myData2);
}
}