View Full Version : deselect initial value from selectfield
sygram
29 Dec 2011, 6:27 AM
Hi there,
i have a selectfield that uses an ajax store to load values. Can anyone tell me how do i deselect the first default option? That is the selectedIndex should be -1. I tried setting value to '', originalValue, startValue but nothing happens.
Thank you very much.
Regards
mitchellsimoens
29 Dec 2011, 11:27 AM
You will need to override the select field. Here is the method that does the selecting:
showComponent: function() {
if (Ext.is.Phone) {
var picker = this.getPicker(),
name = this.name,
value = {};
value[name] = this.getValue();
picker.show();
picker.setValue(value);
}
else {
var listPanel = this.getListPanel(),
index = this.store.findExact(this.valueField, this.value);
listPanel.showBy(this.el, 'fade', false);
listPanel.down('#list').getSelectionModel().select(index != -1 ? index: 0, false, true);
}
},
sygram
29 Dec 2011, 12:38 PM
Hi Mitchell,
thanks for replying.
As far as i can see this method is fired when the user clicks on the selectfield. What i would like to do is remove the initial default selection as soon as the user gets this panel.
Please excuse if otherwise as this is my second day of sencha programming.
Regards,
Leon
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.