PDA

View Full Version : Textfield event listening



alupuli
23 Feb 2010, 10:32 AM
Event listening for a textfield not firing.
Textfield is rendered to a toolbar.




var SearchField = new Ext.form.TextField({
width: 150,
emptyText: 'Search',
listeners: {
'keyup': {
fn: function (obj) {
alert('test');
}
}
}
});
var favGrid = new Ext.grid.GridPanel({
ds: storeObj,
cm: new Ext.grid.ColumnModel([{
id: 'title',
header: "<b><u>Title</u></b>",
sortable: false,
dataIndex: 'title'
}]),
viewConfig: {
forceFit: true
},
autoHeight: true,
width: 200,
collapsible: true,
animCollapse: false,
title: 'My title',
tbar: [SearchField]
});
storeObj.load();
// Apply our layout
var layout = new Ext.Panel({
renderTo: document.body,
layout: 'fit',
border: false,
// Add the gridPanel
items: favGrid,
// Some arbitrary height
autoHeight: true
});

24 Feb 2010, 4:32 PM
add enableKeyEvents : true to the textfield config, look at the API :)