1

我的网格中有一个状态栏。现在我需要在状态栏上添加一个图标并在该图标旁边添加文本。但我可以在状态栏上设置文本而不是图标。谁能帮我解决这个问题?!下面是我的代码:

weekSelectionChange: function(model, records){
    var record = records[0];
    if(record){
        var activeFlag = record.data.activeFlag,
        statuslabel = Ext.getCmp('showgridstatusbar'),
        cashPayLabel = Ext.getCmp('cashPayLabel'),
        lateFeeLabel = Ext.getCmp('lateFeeLabel'),
        icon  = '${resource(dir: "images", file: "TIC01001.png")}',
        status = activeFlag ? '<span style="color:black;font-weight:bold">Installment Status &raquo;  </span>  <span style="color:green;font-weight:bold">Paid</span>' : '<span style="color:black;font-weight:bold">Installment Status &raquo;  </span>  <span style="color:red;font-weight:bold">Due !</span>';
        statuslabel.setIcon(icon);
    }
}
4

1 回答 1

6

状态栏,您可以根据文档设置图标和文本。请参见此处

用图标定义你的 CSS 类。

.x-statusbar .x-status-custom {
        padding-left: 25px;
        background: transparent url(images/custom-icon.gif) no-repeat 3px 2px; -- your icon here
    }


// Setting a default icon:
var sb = Ext.create('Ext.ux.statusbar.StatusBar', {
    defaultIconCls: 'x-status-custom'
});

// Changing the icon:
sb.setStatus({
    text: 'New status',
    iconCls: 'x-status-custom'
});
于 2013-01-12T19:29:20.343 回答