PDA

View Full Version : how to work searchfield type?



myput
14 Oct 2011, 1:54 AM
Hey,

I want to do a search form for ma application who search on a BDD all results with search words.
i use 'searchfield' Xtype, but i don't know how to use this for get results ...
I tried:


WPApp.views.SearchPanelToolbar = new Ext.Toolbar ({
dock: 'top',
items: [
{
xtype: 'searchfield',
placeholder: 'Recherche',
name: 'searchfield',
flex: 1,
handler: function(){
var values = this.form.getValues();
Ext.Ajax.request({
url: WPApp.config.host + WPApp.config.PhpPath + 'searchModule.php',
method: 'post',
params: values,
scope: this,
failure: function (response) {
Ext.Msg.alert('failure', '', Exr.emptyFn);
},
success: function (response, opts) {
Ext.Msg.alert('success', '', Ext.emptyFn);
}
});
}
}
]
});


How i can get the result of searchfield ?

Thanks for help

myput
17 Oct 2011, 7:45 AM
Okey, i find, if someone want the solution, it's like a simple button:



items: [
{
flex: 1,
xtype: 'searchfield',
style: 'margin-right: 10px;',
id: 'textquery',
listeners: {
keyup: function(thisField, e) {
if (e.browserEvent.keyCode == 13) {
var query = Ext.getCmp("textquery").getValue();
Ext.Ajax.request ({
url: WPApp.config.host + WPApp.config.PhpPath + 'searchModule.php?search=' + query,
success: function (e) {}
});
}
}
}
}
]