Sumon Bappi
Sumon Bappi

Reputation: 2019

Extjs4 how to set icon on a statusbar

I have a statusbar in my grid. Now I need to add a icon on the statusbar and text beside that icon. But i can set the text onstatusbar not icon. Can anyone please help me on this ?! Here is my code below :

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);
    }
}

Upvotes: 1

Views: 1297

Answers (1)

srknori
srknori

Reputation: 166

Status bar you can set the icon and text as per docs.. see here

define your css class with the icon.

.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'
});

Upvotes: 6

Related Questions