0

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?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Ilya.R
  • 41
  • 7

1 Answers1

2

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/

cclerv
  • 2,921
  • 8
  • 35
  • 43
  • Yes,problem was in structure of components, i added Ext.draw.Text as item of Chart, and it doesnt work correctly. Thanks for answered – Ilya.R Feb 20 '13 at 08:45