PDA

View Full Version : One Selectfield is not like the other - but why?



DonRul
4 May 2012, 12:17 PM
I have two select fields:

xtype: 'fieldset',
title: 'Clinical Decision',
items: [
{
xtype: 'selectfield',
id: 'analysistypepicker',
label: 'Analysis Type:',
labelWidth: 120,
name: 'analysistypepicker',
displayField: 'Description',
store: 'AnalysisTypeStore',
valueField: 'AnalysisType'
},
{
xtype: 'selectfield',
id: 'analysispicker',
label: 'Analysis:',
labelWidth: 120,
name: 'analysispicker',
displayField: 'AnalysisName',
store: 'AnalysisStore',
valueField: 'AnalysisNumber'
}
]

The second performs as I would expect, you click on the trigger and change the selected item and everything works as expected.
The first select is initially positioned to the first item in the list and you can bring it up and change the selection. This fires a change event and the data that you get the new and old values as expected. If you open the selector again, it appears that the first item in the list is selected, in fact if you click on that first item you don't get a change event.

This is true with other select fields and I am wondering if there is some configuration that I am missing or if some event is being caught and repositioning me to the top of the list.

Any insight would be greatly appreciated,
Don Rule

DonRul
7 May 2012, 3:07 PM
It finally occurred to me that the selects that are giving me trouble are those where I catch the onSelected event. I am guessing that when I catch the event the normal Select processing does not occurr completely. So I have tried to guess what this is and do it myself:


onIndicationSelected: function(selectfield, newValue, oldValue, options) {
if (newValue) {
var me = this;
me.Indication = newValue.data;
selectfield.setData(newValue);
}
},

I have tried selectfield.select selectfield.setRecord and selectfield.setData but none are making the control behave properly. Any ideas would be greatly appreciated.