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

Extjs4如何在状态栏上设置图标,extjs,extjs4.1,extjs-mvc,Extjs,Extjs4.1,Extjs Mvc,我的网格中有一个状态栏。现在我需要在状态栏上添加一个图标 图标旁边的文本。但是我可以在StatusBar上设置文本而不是图标。谁能帮我一下吗?!下面是我的代码: weekSelectionChange: function(model, records){ var record = records[0]; if(record){ var activeFlag = record.data.activeFlag, statuslabel = Ext.ge

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

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);
    }
}
weekSelectionChange:函数(模型、记录){
var记录=记录[0];
如果(记录){
var activeFlag=record.data.activeFlag,
statuslabel=Ext.getCmp('showgridstatusbar'),
cashPayLabel=Ext.getCmp('cashPayLabel'),
lateFeeLabel=Ext.getCmp('lateFeeLabel'),
icon='${resource(dir:images),文件:“TIC01001.png”)},
status=activeFlag?“分期付款状态»;已付款”:“分期付款状态»;到期!”;
statuslabel.setIcon(图标);
}
}

状态栏您可以根据文档设置图标和文本。。看

用图标定义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'
});

状态栏您可以根据文档设置图标和文本。。看

用图标定义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'
});

非常感谢,它很有效。但我需要先清除statusbar,在那里设置另一个文本。有没有办法先清除它,然后设置文本?非常感谢它的工作。但我需要先清除statusbar,在那里设置另一个文本。有没有办法先清除它,然后设置文本?