Ext.draw.Text动态更改文本

问题描述 投票:0回答:1

如何在Ext.draw.Text元素上动态更改文本?

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")

我怎样才能做到这一点?

extjs extjs4 extjs4.1
1个回答
2
投票

我不知道它是否是一个错字,但你的代码应该是这样的:

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

还有thisme所指的是什么?更多代码会有所帮助。无论如何这里是一个工作的例子:http://jsfiddle.net/6zczP/2/

© www.soinside.com 2019 - 2024. All rights reserved.