PDA

View Full Version : ???????ComboBox?????? for FireFox



Kazuhiro Kotsutsumi
18 Mar 2009, 10:53 AM
FireFox???<input type="text" readonly=readonly />??????????????????????????

Ext.form.ComboBox?????????????editable?????????????
?????????readonly???????????FireFox?Ext.form.ComboBox????????????????????????????

????????????????????????blur????????????????
FFCombo221.js????????????????????????????


????????Ext 2.2.1????



FFCombo221.js


/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

// {{{ Ext.ux.override.FFCombo221

/**
* Ext.ux.override.FFCombo221
*
* ??????????????FireFox????????????????
*
* @author Kazuhiro Kotsutsumi <kotsutsumi@xenophy.com>
*/
Ext.override( Ext.form.ComboBox, {

onRender : function( ct, position ) {

Ext.form.ComboBox.superclass.onRender.call(this, ct, position);

if( this.hiddenName ) {
this.hiddenField = this.el.insertSibling({
tag:'input',
type:'hidden',
name: this.hiddenName,
id: (this.hiddenId||this.hiddenName)
},'before', true);

// prevent input submission
this.el.dom.removeAttribute('name');
}
if(Ext.isGecko){
this.el.dom.setAttribute('autocomplete', 'off');
}

if(!this.lazyInit){
this.initList();
}else{
this.on('focus', this.initList, this, {single: true});
}

if(!this.editable){
this.editable = true;
this.setEditable(false);
}

// FireFox?????????????????????????
if( !this.editable && Ext.isGecko ) {
this.el.on(
'focus',
function(){
this.blur();
}
);
}

}
});

/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/

amanoman
18 Mar 2009, 2:51 PM
?????kazuhiro??
????????????????????????????????????kazuhiro????????????????
IE???????????????????????????????????????
Ext??????IE???FF???????????????????????????????????
Ext3.0??????????

Kazuhiro Kotsutsumi
19 Mar 2009, 3:22 AM
?????kazuhiro??
????????????????????????????????????kazuhiro????????????????
IE???????????????????????????????????????
Ext??????IE???FF???????????????????????????????????
Ext3.0??????????

???????Ext 3.0????????
?????Ext3.0 PreAlpha????????????????????????????


FFCombo300.js


/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

// {{{ Ext.ux.override.FFCombo300

/**
* Ext.ux.override.FFCombo300
*
* ??????????????FireFox????????????????
*
* @author Kazuhiro Kotsutsumi <kotsutsumi@xenophy.com>
*/
Ext.override( Ext.form.ComboBox, {

onRender : function( ct, position ) {

Ext.form.Checkbox.superclass.onRender.call(this, ct, position);
if(this.inputValue !== undefined){
this.el.dom.value = this.inputValue;
}
this.wrap = this.el.wrap({cls: "x-form-check-wrap"});
if(this.boxLabel){
this.wrap.createChild({tag: 'label', htmlFor: this.el.id, cls: 'x-form-cb-label', html: this.boxLabel});
}
if(this.checked){
this.setValue(true);
}else{
this.checked = this.el.dom.checked;
}

// FireFox?????????????????????????
if( !this.editable && Ext.isGecko ) {
this.el.on(
'focus',
function(){
this.blur();
}
);
}

}
});

/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/

kiyoto01
20 Mar 2009, 5:20 AM
FFCombo221.js ??????????????

Kazuhiro Kotsutsumi
16 Apr 2009, 6:35 AM
RC1????????????
????????????????????

?????????????2.2.1???3.0RC1?????????


/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

// {{{ Ext.ux.override.FFCombo

/**
* Ext.ux.override.FFCombo
*
* ??????????????FireFox????????????????
*
* @author Kazuhiro Kotsutsumi <kotsutsumi@xenophy.com>
*/
if( Ext.version === '2.2.1' ) {

// Ext JS 2.2.1
Ext.override( Ext.form.ComboBox, {

onRender : function( ct, position ) {

Ext.form.ComboBox.superclass.onRender.call(this, ct, position);

if( this.hiddenName ) {
this.hiddenField = this.el.insertSibling({
tag:'input',
type:'hidden',
name: this.hiddenName,
id: (this.hiddenId||this.hiddenName)
},'before', true);

// prevent input submission
this.el.dom.removeAttribute('name');
}
if(Ext.isGecko){
this.el.dom.setAttribute('autocomplete', 'off');
}

if(!this.lazyInit){
this.initList();
}else{
this.on('focus', this.initList, this, {single: true});
}

if(!this.editable){
this.editable = true;
this.setEditable(false);
}

// FireFox?????????????????????????
if( !this.editable && Ext.isGecko ) {
this.el.on(
'focus',
function(){
this.blur();
}
);
}
}

});

} else if( Ext.version === '3.0' ) {

// Ext JS 3.0
Ext.override( Ext.form.ComboBox, {

initEvents : function(){
Ext.form.Checkbox.superclass.initEvents.call(this);
this.mon(this.el, 'click', this.onClick, this);
this.mon(this.el, 'change', this.onClick, this);

// FireFox?????????????????????????
if( !this.editable && Ext.isGecko ) {

this.mon(this.el, 'focus', function(){
this.blur();
}, this );
}

}

});

}

/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/

Kazuhiro Kotsutsumi
27 Apr 2009, 12:57 AM
Ext JS 3.0??2.2.1????
????RC1?Ext.form.ComboBox?initEvents?????????????????
????????????
??????ComboBox????????????fn is undefined??????????????



/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

// {{{ Ext.ux.override.FFCombo

/**
* Ext.ux.override.FFCombo
*
* ??????????????FireFox????????????????
*
* @author Kazuhiro Kotsutsumi <kotsutsumi@xenophy.com>
*/
if( Ext.version === '2.2.1' ) {

// Ext JS 2.2.1
Ext.override( Ext.form.ComboBox, {

onRender : function( ct, position ) {

Ext.form.ComboBox.superclass.onRender.call(this, ct, position);

if( this.hiddenName ) {
this.hiddenField = this.el.insertSibling({
tag:'input',
type:'hidden',
name: this.hiddenName,
id: (this.hiddenId||this.hiddenName)
},'before', true);

// prevent input submission
this.el.dom.removeAttribute('name');
}
if(Ext.isGecko){
this.el.dom.setAttribute('autocomplete', 'off');
}

if(!this.lazyInit){
this.initList();
}else{
this.on('focus', this.initList, this, {single: true});
}

if(!this.editable){
this.editable = true;
this.setEditable(false);
}

// FireFox?????????????????????????
if( !this.editable && Ext.isGecko ) {
this.el.on(
'focus',
function(){
this.blur();
}
);
}
}

});

} else if( Ext.version === '3.0' ) {

// Ext JS 3.0
Ext.override( Ext.form.ComboBox, {

initEvents : function(){

Ext.form.ComboBox.superclass.initEvents.call(this);

this.keyNav = new Ext.KeyNav(this.el, {
"up" : function(e){
this.inKeyMode = true;
this.selectPrev();
},

"down" : function(e){
if(!this.isExpanded()){
this.onTriggerClick();
}else{
this.inKeyMode = true;
this.selectNext();
}
},

"enter" : function(e){
this.onViewClick();
this.delayedCheck = true;
this.unsetDelayCheck.defer(10, this);
},

"esc" : function(e){
this.collapse();
},

"tab" : function(e){
this.onViewClick(false);
return true;
},

scope : this,

doRelay : function(foo, bar, hname){
if(hname == 'down' || this.scope.isExpanded()){
return Ext.KeyNav.prototype.doRelay.apply(this, arguments);
}
return true;
},

forceKeyDown : true
});
this.queryDelay = Math.max(this.queryDelay || 10,
this.mode == 'local' ? 10 : 250);
this.dqTask = new Ext.util.DelayedTask(this.initQuery, this);
if(this.typeAhead){
this.taTask = new Ext.util.DelayedTask(this.onTypeAhead, this);
}
if(this.editable !== false){
this.mon(this.el, 'keyup', this.onKeyUp, this);
}
if(this.forceSelection){
this.on('blur', this.doForce, this);
}

// FireFox?????????????????????????
if( !this.editable && Ext.isGecko ) {

this.mon(this.el, 'focus', function(){
this.blur()
}, this );
}

}

});

}

/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* End:
*/