PDA

View Full Version : [Solved] Grid, Ajax and TextField



sunco
20 Oct 2009, 1:26 PM
I have a Window with a TextField and the next Grid. What i want to do is that when you write something on the TextField, then do a search with Ajax and the result fills the Grid

This code works very fine with a ComboBox but can't make it work on a Grid. All the samples are with static Arrays or one Ajax call, but not based on a TextField



var storeBusqueda = new Ext.data.Store({
proxy: new Ext.data.ScriptTagProxy({
url: 'includes/ajax.php'
}),
reader: new Ext.data.JsonReader({
root: 'calles',
totalProperty: 'registros',
id: 'id'
}, [
{name: 'nombre', mapping: 'nombre'},
{name: 'colonia', mapping: 'colonia'},
{name: 'ciudad', mapping: 'ciudad'},
{name: 'estado', mapping: 'estado'}
])
});

storeBusqueda.baseParams = { accion : "BuscaCalle" };

var gridBusqueda = new Ext.grid.GridPanel({
store: storeBusqueda,
style: 'padding:2px;',
columns: [
{header: 'Calle', width: 160, sortable: true, dataIndex: 'nombre'},
{header: 'Colonia', width: 140, sortable: true, dataIndex: 'colonia'},
{header: 'Ciudad', width: 140, sortable: true, dataIndex: 'ciudad'},
{header: 'Estado', width: 140, sortable: true, dataIndex: 'estado'}
]
});


On the TextField i want to use this



listeners: {
keyup:function(t,e){
storeBusqueda.loadData();
}
}


The error is: 'metaData' is null or not an object

sunco
20 Oct 2009, 1:50 PM
Well, the problem is loadData(); and must be just load();