如何使用Ext.js 4.2在渲染器html中调用函数

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

代码是:

Ext.define("Myapp", {
  extend: '',
  config: {},

  initComponent: function () {},

  getGrid: function () {
    Ext.create("Ext.grid.Panel", {
      ...
      columns: [
        {
          header: 'xx',
          renderer: function (value) {
            return '<a onclick=''>text</a>';
          }
        }
      ]
    });
  },

  test: function(){
    alert(1);
  },
});

在上面的代码中,我想在onc​​lick事件中调用测试功能。我尝试了Myapp.test(),但是没有用。

有什么办法吗?

extjs
1个回答
0
投票

您必须向该单元格添加一个侦听器,并在用户单击'a'标记后检查侦听器功能。

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