1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
var foundProtocolRecord = Ext.data.Record.create([
{name: 'id'},
{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><br />',
'<i><spring:message code="dataEntryMgmt.protocolId"/>{id}</i>',
'</div></tpl>'
);
new Ext.form.ComboBox({
id: 'protocolSearch',
name: 'protocolSearch',
hideLabel: true,
store: protocolSearchDataStore,
displayField:'alias',
typeAhead: false,
loadingText: '<spring:message code="dataEntryMgmt.protocolSearchLoadText"/>',
width: 175,
minChars: 3,
hideTrigger:true,
tpl: protocolSearchResultTemplate,
itemSelector: 'div.search-item',
/*select: function(combo, record, index) {*/
onSelect: function(record){
this.setValue(record.data.alias+" ("+record.data.id+")");
Ext.getCmp("centerSearch").store.baseParams = { protocolId: record.data.id };
this.collapse();
},
onFocus: function(){
this.reset();
Ext.getCmp("centerSearch").reset();
Ext.getCmp("subjectTreeView").root.removeAll();
Ext.getCmp("findASubject").reset();
}
}), |
Partager