ComboBox Reset Event

Post modules, themes or any other code you want to share with the community.

Moderator: Developers

alessandro.gagliano
Posts: 12
Joined: Thu Mar 05, 2009 9:07 am

ComboBox Reset Event

Postby alessandro.gagliano » Thu Mar 05, 2009 9:18 am

I think it is a good idea add the "reset" event to ComboBoxReset,

this is my solution:

GO.form.ComboBoxReset = Ext.extend(GO.form.ComboBox, {

validationEvent:false,
validateOnBlur:false,
trigger1Class:'x-form-clear-trigger',
trigger2Class:'',
//hideTrigger1:true,
width:180,
hasSearch : false,
paramName : 'query',

initComponent : function() {
GO.form.ComboBoxReset.superclass.initComponent.call(this);

this.triggerConfig = {
tag:'span', cls:'x-form-twin-triggers', cn:[
{tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.trigger1Class},
{tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.trigger2Class}
]};

this.addEvents (
{
'reset' : true
});

},

getTrigger : function(index)
{
return this.triggers[index];
},

initTrigger : function(){
var ts = this.trigger.select('.x-form-trigger', true);
this.wrap.setStyle('overflow', 'hidden');
var triggerField = this;
ts.each(function(t, all, index){
t.hide = function(){
var w = triggerField.wrap.getWidth();
this.dom.style.display = 'none';
triggerField.el.setWidth(w-triggerField.trigger.getWidth());
};
t.show = function(){
var w = triggerField.wrap.getWidth();
this.dom.style.display = '';
triggerField.el.setWidth(w-triggerField.trigger.getWidth());
};
var triggerIndex = 'Trigger'+(index+1);

if(this['hide'+triggerIndex]){
t.dom.style.display = 'none';
}
t.on("click", this['on'+triggerIndex+'Click'], this, {preventDefault:true});
t.addClassOnOver('x-form-trigger-over');
t.addClassOnClick('x-form-trigger-click');
}, this);
this.triggers = ts.elements;
},

onTrigger1Click : function()
{

this.reset();
this.fireEvent( 'reset', this );
this.hasSearch = false;

},

onTrigger2Click : function()
{
this.onTriggerClick();
}


});
mschering
Site Admin
Site Admin
Posts: 8193
Joined: Tue Apr 20, 2004 1:06 pm
Location: The Netherlands - Den Bosch
Contact:

Re: ComboBox Reset Event

Postby mschering » Thu Mar 05, 2009 9:31 am

Thanks, I added this to the code.
Best regards,

Merijn Schering
Intermesh

Who is online

Users browsing this forum: No registered users and 1 guest

cron