so its only trigger field :P appended field is the secons field in the line...
Original Files
My Version:
Ext.ux.form.myTriggerField.js
/*!
* Ext JS Library 3.0.0
* Copyright(c) 2006-2009 Ext JS, LLC
* licensing@extjs.com
* http://www.extjs.com/license
*/
Ext.ns('Ext.ux.form');
Ext.ux.form.myTriggerField = Ext.extend(Ext.form.TwinTriggerField, {
initComponent : function(){
Ext.ux.form.myTriggerField.superclass.initComponent.call(this);
this.on('specialkey', function(f, e){
if(e.getKey() == e.ENTER){
this.onTrigger2Click();
}
}, this);
},
validationEvent:false,
validateOnBlur:false,
enableKeyEvents:true,
trigger1Class:'x-form-clear-trigger',
trigger2Class:'x-form-search-trigger',
hideTrigger1:true,
width:180,
hasSearch : true,
paramName : 'query',
tabIndex:999,
onTrigger1Click : function(){
if(!this.disabled){
if(this.hasSearch){
this.el.dom.value = '';
this.clearHandler();
this.triggers[0].hide();
this.hasSearch = false;
}
}
},
onTrigger2Click : function(){
if(!this.disabled){
var v = this.getRawValue();
if(v.length < 1){
this.triggers[0].hide();
this.hasSearch = false;
//return ;
}
this.searchHandler();
this.hasSearch = true;
this.triggers[0].show();
}
}
});
Ext.reg('myTriggerField', Ext.ux.form.myTriggerField);
usage:
{
xtype:'myTriggerField',
fieldLabel:'Search',
name:'search',
width: 120,
allowBlank:false,
clearHandler: function(){
//your clear function
//example: this.setValue('');
},
searchHandler: function(){
//your search function
//like open a grid ou submit a request
}
}
i thinks its all