【问题标题】:Transparency of image in a grid网格中图像的透明度
【发布时间】:2014-09-10 20:46:51
【问题描述】:

我的 extjs 4.2 MVC 应用程序在网格和图像透明度方面有一点问题: 这是我的网格:

Ext.define('XProject.view.message.inbox.Grid', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.inboxgrid',
    store: 'message.Inbox',
    requires: [
        'Ext.ux.grid.FiltersFeature'  ,
        'XMailweb.view.message.inbox.CtxMenu'
    ],

    viewConfig: {
        getRowClass: function (record, rowIndex, rowParams, store) {
            if ((record.get('Flags') & 2 )== 0) {
                return "boldFont";
            }
            if (record.get('Err_Id') != 0) {
                return "redFont";
            }            
        }
    },

    selType: 'checkboxmodel',
    selModel: {
        checkOnly: false,
        injectCheckbox: 0
    },    

    features : [{
        ftype: 'filters',
        autoReload: false, 
        encode:true,
        paramPrefix : 'Filter'
    }],

    columns: [{
        xtype: 'gridcolumn',
        cls: 'attach',
        width: 18,
        dataIndex: 'Files_Num',
        menuDisabled: true,
        sortable:false,
        text: 'Attachment',
        renderer: function(value, metaData, record ){
            if (value >= 1){
                metaData.css  = 'attach';
            }
            return '';
        }       
    }]
})

省略其他列。 我的 CSS 角色是:

.attach {
    background:transparent url('../icons/attach.png') no-repeat center left !important;
    text-indent: -250px;
}

我的 attach.png 是透明的,但是在渲染网格时(使用备用行背景颜色)显示为白色背景。 这是我的透明图像:

还有我渲染的网格:

为什么没有透明背景(网格中的所有 CSS 图像)? 我尝试使用 firefox 和 iexplorer,但结果是一样的。 有什么想法吗?

【问题讨论】:

    标签: html css extjs


    【解决方案1】:

    Background:transparent 覆盖背景颜色。

    使用:

    .attach,.attach .x-column-header-over{
        background-image:url('../icons/attach.png') !important;
        background-position:center left;
        background-repeat:no-repeat ;
    }
    

    之间:

    background:transparent url('../icons/attach.png') no-repeat center left !important;
    

    http://jsfiddle.net/Xpe9V/521/

    【讨论】:

    • 你太棒了!另一个问题是附加的标题:当鼠标悬停时,图标隐藏。为什么?
    • 您需要覆盖 .x-column-header-over 背景
    • 如果我有其他标题和其他图像?我该怎么办?
    • 您创建了一个新列和一个新类。
    • 现在完美了JSFIDDLE 非常感谢
    猜你喜欢
    • 1970-01-01
    • 2013-01-22
    • 1970-01-01
    • 2010-12-01
    • 2020-01-03
    • 2016-02-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多