javascript - 在 Extjs 中动态更改超链接文本

标签 javascript extjs

下面是我使用 ExtJS 在页面中创建链接的代码:

var linkTransValues = {
    xtype: 'box',
    id : 'testId',
    hidden : true,
    autoEl: {
        tag: 'a', 
        href: 'javascript:addCategoryValue()', 
        html: 'Add Transition Category'
    }
}

现在我想要的是,当用户从一个组合框中选择值时,无论组合框描述是什么,描述都应该出现在链接文本中,这是我在选择组合框时调用的代码:

transType.on('select', function(cbox, rec, index) {        
    Ext.getCmp("testId").transId = cbox.getValue();
    Ext.getCmp("testId").autoEl.html="dropdown description";
    Ext.getCmp("testId").show();
});

问题是它正在更改 html 值,但新值没有反射(reflect)其仅显示初始值如何更改链接值。我怎样才能改变它?

最佳答案

尝试

    var linkTransValues = {
             xtype: 'box',
             id : 'testId',
             hidden : true,
             autoEl: {tag: 'a', id: 'my-element', href: 'javascript:addCategoryValue()', html: 'Add Transition Category'}
            };

    Ext.get('my-element').update('new value');

关于javascript - 在 Extjs 中动态更改超链接文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9188347/

相关文章:

extjs - 是否可以在 AngularJS 中使用 ExtJS 组件?

php - 简单的 JavaScript 跟踪脚本

javascript - 使用热键更改文本大小写(如 MS-Word 中的 Shift+F3)

javascript - 将 onclick 分配给函数问题

javascript - 如何在一个代码中检查无效的日期格式和大于 18 岁的年龄验证?

javascript - ExtJS:范围混淆

php - extjs 4 : filling combobox using MYSQL db via PHP script

javascript - ExtJS TreePanel - 刷新并保持节点状态

javascript - ExtJS 4.2.2 组合框字段显示在窗口后面

javascript - 如何从一组中随机选择一个 div 并为其分配一个事件