EXT iconCls说明

来源:互联网 发布:小米笔记本 linux版本 编辑:程序博客网 时间:2024/04/25 15:12
 

今天学习ext 看examples中的事例,其中有一个地方是这样写的:

new ButtonPanel(
            'Icon Only',
            [{
                iconCls: 'add16'
            },{
                iconCls: 'add24',
                scale: 'medium'
            },{
                iconCls: 'add',

                scale: 'large'
            }]
        );

例子的效果是:


看了半天没有明白iconCls后面的add16 ,add24是什么意思。后来看到buttons.css 终于明白了应该是图片样式的意思,既是CSS里面定义的class。

后来看了看API,里面也是这么写的。遇到什么问题还是多看API。

iconCls : String

用来指定背景图片的样式类。A css class which sets a background image to be used as the icon for this button

/*!
* Ext JS Library 3.2.1
* Copyright(c) 2006-2010 Ext JS, Inc.
* licensing@extjs.com
* http://www.extjs.com/license
*/
.add {
    background-image: url(images/add.gif) !important;
}
.add16 {
    background-image: url(images/add16.gif) !important;
}
.add24 {
    background-image: url(images/add24.gif) !important;
}

.btn-panel td {
    padding-left:5px;
}

h2 {
    color:#083772 !important;
    margin: 20px 0 0 !important;
    padding: 5px;
    background:#eee;
    width:400px;
}

h3 {
    font-weight:normal !important;
}