`
h07061108
  • 浏览: 77846 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论

更改控件背景色,如textfield

阅读更多
Ext.onReady( function() {
var colorShowId = '';

function showColor(id) {
colorShowId = id;
var colorText = Ext.getCmp(id);
colorWin.x = colorText.getPosition()[0] + colorText.getWidth();
colorWin.y = colorText.getPosition()[1];
colorWin.show();
}

var menu = new Ext.menu.ColorMenu({
listeners: {
        select: function(picker, selColor) {
            var color = '#' + selColor;
  Ext.getDom(colorShowId).style.background = color;
  colorWin.hide();
        }
    }
});


var colorWin = new Ext.Window( {
title : 'yyy',
constrain : true,
layout : 'fit',
plain : true,
width : 380,
height : 300,
closeAction : 'hide',
animCollapse : true,
animateTarget : Ext.getBody(),
modal : true,
items : [
{
xtype : 'button',
text : 'hzy',
menu : menu
}
]
}) ;


var form = new Ext.form.FormPanel({
width:200,
items : [
{
xtype : 'textfield',
id : 'aa',
fieldLabel : 'xxxxxx'
}
],
buttonAlign : 'center',
buttons: [{
        text: 'xxx',
        style:'background:red',
        handler: function(btn) {
showColor('aa');
        }
    } ]
});
var viewport = new Ext.Viewport({
layout : 'fit',
items : [form]
});
viewport.doLayout();
});
  • 大小: 6.8 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics