View Full Version : impossible to display a selected value in a combobox

7 Aug 2010, 3:04 AM
I coded the following combobox

var foundProtocolRecord = Ext.data.Record.create([
{name: 'alias'}

var protocolSearchDataStore = new Ext.data.Store({
proxy: new Ext.data.ScriptTagProxy({
url: '<c:url value="/secure/getProtocolList.htm"/>'

reader: new Ext.data.JsonReader({
root: 'rows',
totalProperty: 'totalCount',
id: 'id'
}, foundProtocolRecord
sortInfo: {
field: 'alias',
direction: 'ASC'

var protocolSearchResultTemplate = new Ext.XTemplate(
'<tpl for="."><div class="search-item">',
'<h3><img src="<c:url value="/img/study.gif"/>"/> <spring:message code="dataEntryMgmt.alias"/>{alias}</h3>',

new Ext.form.ComboBox({
id: 'protocolSearch',
name: 'protocolSearch',
hideLabel: true,
store: protocolSearchDataStore,
forceSelection : true,
typeAhead: false,
loadingText: '<spring:message code="dataEntryMgmt.protocolSearchLoadText"/>',
width: 175,
minChars: 3,
tpl: protocolSearchResultTemplate,
itemSelector: 'div.search-item',
onSelect: function(record) {
var centerSearch = Ext.getCmp("centerSearch");
centerSearch.store.proxy.url = '/secure/getCenterList.htm?protocolId='+record.id;
centerSearch.disabled = false;
var subjectTree = Ext.getCmp("subjectTreeView");
subjectTree.dataUrl = './getSubjectsTreeNodes.htm';
var rootNode = Ext.getCmp("subjectTreeView").root;
var findASubject = Ext.getCmp("findASubject");

The request works well and when I type something in my combobox, the request display a list of protocols. Unfortunately when I select something in the list, it doesn't display in the combobox field and the onSelect method isn't fired (I debugged it in firebug by putting a break point).
Anyone has an idea ? Thanks in advance

7 Aug 2010, 3:33 AM
You should be using a 'select' event handler instead of overriding the onSelect method.

7 Aug 2010, 3:43 AM
Thank you for your answer
Yes I will try the select event handler. Anyway my method works fine in another application and it doesn't work here. I can't explain why