`
skzr.org
  • 浏览: 356436 次
  • 性别: Icon_minigender_1
  • 来自: 长沙
社区版块
存档分类
最新评论

ExtJS4 textfield msgTagert=side显示和以前不一样

 
阅读更多

 

  1. 问题现象多说无益,有图有真象:)


  2. 详细代码可以看, ExtJS 包中的例子:/examples/form/dynamic.html
    Example: Form 1 - Very Simple
  3. Fixed:请去掉logger.info这一行,这个logger是我自己定义的仿造日志货
    if (Ext.versions.extjs.getMajor() == 4) {
    	Ext.Loader.require('Ext.layout.component.field.Field', function() {
    		logger.info('修复form.Field在msgTarget=side时的width显示变化的bug');
    		
    		Ext.layout.component.field.Field.prototype.errorStrategies.side.getErrorElWidth = function(owner) {
    			if (owner.autoFitErrors && owner.hasActiveError()) return owner.errorEl.getWidth();
    
    			if (!this.errorElWidth) {
    				var errorEl = owner.errorEl,
    	    			display = errorEl.getStyle('display');
    	    		if (display == 'none') errorEl.setDisplayed(true);
    	
    	    		this.errorElWidth = errorEl.getWidth();
    	    		if (display == 'none') errorEl.setDisplayed(false);
    			}
    			
    			return this.errorElWidth;
    		};
    		
    		Ext.layout.component.field.Field.prototype.errorStrategies.side.prepare = Ext.Function.createSequence(
    			Ext.layout.component.field.Field.prototype.errorStrategies.side.prepare,
    			function(owner, info) {
    	            if (info.autoWidth) info.width += this.getErrorElWidth(owner);
    			}
    		);
    			
    		Ext.layout.component.field.Field.prototype.errorStrategies.side.adjustHorizInsets = function(owner, info) {
                info.insets.right += this.getErrorElWidth(owner);
            };
    	});
    	
    }
     

 

  • 大小: 118.9 KB
  • 大小: 121.8 KB
1
3
分享到:
评论
1 楼 skzr.org 2011-07-20  
sencha开发组的解答:
引用

This is a new feature of 4.x. It uses the entire width so the layout looks better but if you use the msgTarget as side it will shrink the field to allow the error icon in there. IMO, this behavior is nice!


不过对于msgTarget=side的这个特性,我感觉 视觉上有点 参差不齐

相关推荐

Global site tag (gtag.js) - Google Analytics