* @cfg {Boolean} append (true|false) default false
* @cfg {Boolean} autoFocus (true|false) auto focus the first item, default true
* @cfg {Boolean} tickable ComboBox with tickable selections (true|false), default false
+ * @cfg {Boolean} editNotList allow text type,but not show pull down, default false
* @cfg {String} btnPosition set the position of the trigger button (left | right) default right
* @constructor
* Create a new ComboBox.
autoFocus : true,
tickable : false,
btnPosition : 'right',
-
+ editNotList : false,
// element that contains real text value.. (when hidden is used..)
getAutoCreate : function()
]
};
+ var _this = this;
Roo.each(buttons.cn, function(c){
- if (this.size) {
- c.cls += ' btn-' + this.size;
+ if (_this.size) {
+ c.cls += ' btn-' + _this.size;
}
- if (this.disabled) {
- c.disabled=true;
+ if (_this.disabled) {
+ c.disabled = true;
}
});
this.choices = this.el.select('ul.select2-choices', true).first();
this.searchField = this.el.select('ul li.select2-search-field', true).first();
-
+ if(this.editNotList){
+ this.searchField.on("click", this.onSearchFieldClick, this, {preventDefault:true});
+ }
+
this.trigger = this.el.select('.tickable-buttons > .btn-edit', true).first();
- this.trigger.on("click", this.onTriggerClick, this, {preventDefault:true});
+ this.trigger.on("click", this.onTickableTriggerClick, this, {preventDefault:true});
this.okBtn = this.el.select('.tickable-buttons > .btn-ok', true).first();
this.cancelBtn = this.el.select('.tickable-buttons > .btn-cancel', true).first();
this.okBtn.on('click', this.onTickableFooterButtonClick, this, this.okBtn);
this.cancelBtn.on('click', this.onTickableFooterButtonClick, this, this.cancelBtn);
- Roo.log(this.trigger);
+
this.trigger.setVisibilityMode(Roo.Element.DISPLAY);
+ this.okBtn.setVisibilityMode(Roo.Element.DISPLAY);
+ this.cancelBtn.setVisibilityMode(Roo.Element.DISPLAY);
+
+ this.okBtn.hide();
+ this.cancelBtn.hide();
var _this = this;
this.list.dom.innerHTML = '';
}
- if(this.footer){
- this.footer.dom.innerHTML = '';
- }
if(this.store){
this.store.un('beforeload', this.onBeforeLoad, this);
this.store.un('load', this.onLoad, this);
return;
}
+ this.hasFocus = false;
+
this.list.hide();
if(this.tickable){
- this.footer.hide();
+ this.okBtn.hide();
+ this.cancelBtn.hide();
this.trigger.show();
}
this.tickItems = Roo.apply([], this.item);
- (function(){
- this.footer.alignTo(this.list, 'tl-bl?');
- this.footer.show();
- }).defer(10, this);
-
+ this.okBtn.show();
+ this.cancelBtn.show();
this.trigger.hide();
}
// private
// Implements the default empty TriggerField.onTriggerClick function
- onTriggerClick : function()
+ onTriggerClick : function(e)
{
Roo.log('trigger click');
return;
}
- if(this.tickable){
- this.onTickableTriggerClick();
- return;
- }
-
this.page = 0;
this.loadNext = false;
}
},
- onTickableTriggerClick : function()
+ onTickableTriggerClick : function(e)
{
+ if(this.disabled){
+ return;
+ }
+
+ this.page = 0;
+ this.loadNext = false;
+ this.hasFocus = true;
+
+ if(this.triggerAction == 'all') {
+ this.doQuery(this.allQuery, true);
+ } else {
+ this.doQuery(this.getRawValue());
+ }
+ },
+
+ onSearchFieldClick : function(e)
+ {
+ if(this.hasFocus || this.disabled || e.getTarget().nodeName.toLowerCase() == 'button'){
+ return;
+ }
+
this.page = 0;
this.loadNext = false;
this.hasFocus = true;