【问题标题】:Ext.draw.Text dynamically change textExt.draw.Text 动态改变文字
【发布时间】:2013-02-13 19:27:01
【问题描述】:

如何在 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】:

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

    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/

    【讨论】:

    • 是的,问题出在组件的结构上,我将 Ext.draw.Text 添加为图表项,但它不能正常工作。感谢您的回答
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-19
    • 1970-01-01
    • 1970-01-01
    • 2012-05-01
    • 1970-01-01
    • 2011-06-19
    相关资源
    最近更新 更多