PDA

View Full Version : ComboBox (forum search) not working



Haarold
7 Sep 2009, 7:18 AM
Hi,

I've discovered Extjs recently and I met some problems quickly. I've read hundreds of files and docs before asking for help but now, I'm about to break.

I want to use this crazy tool (http://www.extjs.com/deploy/dev/examples/form/forum-search.html) to allow the user to select a lead quickly by writing some letters. However, it doesn't work during tests with this code :

Generated Json :

{"menu": "Fichier","commands":[{"title":"Nouveau","action":"CreateDoc"},{"title":"Open","action":"OpenDoc"},{"title":"Close","action":"CloseDoc"}]}

JS :

Ext.onReady(function(){

var ds = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: 'http://srv-dev/vtigersylaxe51.com/include/sylaxe/php/recherche_autocompletion.php'
}),
reader: new Ext.data.JsonReader({
root: 'results',
totalProperty: 'totalrows',
id: 'id'
}, [
{name: 'title', mapping: 'title'},
{name: 'action', mapping: 'action'},
])
});

// Custom rendering Template
var resultTpl = new Ext.XTemplate(
'<tpl for="."><div class="search-item">',
'<h3><span>{title}<br /></span>{action}</h3>',
'{excerpt}',
'</div></tpl>'
);

var search = new Ext.form.ComboBox({
store: ds,
displayField:'title',
typeAhead: false,
loadingText: 'Recherche en cours...',
width: 300,
pageSize:10,
hideTrigger:true,
tpl: resultTpl,
applyTo: 'societeid',
itemSelector: 'div.search-item',
onSelect: function(record){ // override default onSelect to do redirect
alert('test');
}
});
});

I'm working on a local server, and the previous example (with the online file) was working correctly. But now, when I write something like "Open", I've got no answer...

Does someone have any idea of the problem ?

Best regards,
Haarold

Haarold
7 Sep 2009, 11:22 PM
Shame on me...

I've read it so many time and I never notice that I failed writing down the url...