PDA

View Full Version : grid with ext direct



jvolt
29 Apr 2010, 9:28 AM
How to use Ext Direct with Grid?

Anyone got a simple example?

Got that solved by adding:


jsonReader = new Ext.data.JsonReader({
root: 'list',
fields: [
{name: 'chv_cotacao', type: 'string'}
]
});

mystore = new Ext.data.DirectStore({
reader: jsonReader,
paramsAsHash: false,
paramsNames: {
d: "d"
},
paramOrder: 'd',
autoLoad: true,
baseParams: {d: data},
storeId:'mystore',
fields: 'chv_cotacao',
directFn: Cotacao.getCotacoes
});

estrutura = new Ext.Viewport({
layout:'border',
border:false,
items:[{
region:'west',
width: '33%',
autoScroll:true,
title:'Cotações',
bodyStyle:'font-size:11px;',
margins: '32 5 0 0',
items:
new Ext.grid.GridPanel({
store: mystore,
id: 'gcotacao',
columns: [
{id:'chv_cotacao', header: 'j', sortable: true, dataIndex: 'chv_cotacao'}
],
stripeRows: true,
autoHeight: true,
border: false
})
},{
region:'east',
html:'Informações do cadastro',
width: '33%',
autoScroll:true,
bodyStyle:'padding:5px;font-size:11px;',
margins: '32 0 0 5',
title:'Informações do cadastro'
},{
region:'center',
html:'Center',
width: '33%',
autoScroll:true,
bodyStyle:'padding:5px;font-size:11px;',
margins: '32 0 0 0',
title:'Informações da cotação'
}]
});
aguarde.hide();
Ext.getCmp('gcotacao').on('click', function(sm, index, record){
getCotacoes('data')
});