PDA

View Full Version : combo box foreceSelect



mohaskuar
31 Jan 2013, 8:09 AM
am using a combobox with forecSelect:true, multiSelect:false, when i record which is not in the list is givien to the combo it will set the last selected value but at start it will set to NULL..... what i wanted is to always set to NULL or empty when the value is not from the list..... or when cam i overide this thing
lastSelected=[];

friend
31 Jan 2013, 8:15 AM
From looking at the source (http://docs.sencha.com/ext-js/4-1/source/ComboBox2.html#Ext-form-field-ComboBox), it appears that lastSelected is only set when autoSelect: true. You can most likely override the doAutoSelect method to get what you're after.

As an alternative, you might be able to listen for the change and select events and reset the lastSelected property there.

mohaskuar
31 Jan 2013, 10:13 PM
loking through the source i tried to change a line

<code>

assertValue: function() {
var me = this,
value = me.getRawValue(),
NullValue="select";
rec;

if (me.forceSelection) {
if (me.multiSelect) {
// For multiselect, check that the current displayed value matches the current
// selection, if it does not then revert to the most recent selection.
if (value !== me.getDisplayValue()) {
me.setValue(me.lastSelection);
}
} else {
// For single-select, match the displayed value to a record and select it,
// if it does not match a record then revert to the most recent selection.
rec = me.findRecordByDisplay(value);
if (rec) {
me.select(rec);
} else {
me.setValue(me.lastSelection);******* i have changed this line to me.setValue(""); ***** but nuthing has changed what shall i do ? or please show me some example how to overide this thing******
}
}
}
me.collapse();
},

</code>