AlonG
AlonG

Reputation: 79

ExtJS - How can I color just a part of the text

I use the setTitle inside a function for a dynamic title for my grid.panel and add variables to it.

Is there a way to color only the vars? For example, I want the ondevs to be green.

changeTitle: function(){
    var ondevs = 0;
    var offdevs = 0;
    this.getView().setTitle(Strings.dev + " - " + ondevs + " Online " + offdevs + " Offline");
}

Thanks!

Upvotes: 0

Views: 185

Answers (1)

Alexander
Alexander

Reputation: 20224

You can just put any HTML you want into a panel header (panel, formpanel, gridpanel):

Ext.create('Ext.panel.Panel',{
    renderTo:Ext.getBody(),
    width:300,
    height:100,
    title:'<span style="color:springgreen">17</span> Online</u>'
});

https://fiddle.sencha.com/#fiddle/1g4a

Upvotes: 1

Related Questions