Ilya.R
Ilya.R

Reputation: 41

Ext.draw.Text dynamically change text

How to change text dynamically on Ext.draw.Text element?

this.textLabel = Ext.create "Ext.draw.Text"
        type  : 'text',
        text  : me.curValue,
        font  : '24px Arial',
        width : 100,
        height: 30,
        x : 100 
        y : 120

This method doesn't work:

   this.textLabel.setText("new text")

How can I do that?

Upvotes: 0

Views: 2079

Answers (1)

cclerv
cclerv

Reputation: 2969

I don't know if its a typo but your code should look something like this:

this.textLabel = Ext.create('Ext.draw.Text', {
    type  : 'text',
    text  : me.curValue,
    font  : '24px Arial',
    width : 100,
    height: 30,
    x : 100, 
    y : 120
});

this.textLabel.setText("new text");

Also what does this and me refer to? More code would be helpful. Anyways here is a working example: http://jsfiddle.net/6zczP/2/

Upvotes: 2

Related Questions