Extjs4如何在状态栏上设置图标

Sum*_*ppi 1 extjs extjs-mvc extjs4.1

我的网格中有一个状态栏.现在我需要在状态栏上添加一个图标,并在该图标旁边添加文字.但我可以在onstatusbar上设置文字而不是图标.有人可以帮我这个吗?!这是我的代码如下:

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);
    }
}
Run Code Online (Sandbox Code Playgroud)

小智 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'
});
Run Code Online (Sandbox Code Playgroud)