【问题标题】:Extjs 6.x Modern : Why template methods like onRender are not working?Extjs 6.x Modern:为什么像 onRender 这样的模板方法不起作用?
【发布时间】:2017-04-21 05:42:22
【问题描述】:

正如本 Docx Component Life Cycle 中提到的,模板方法如 initComponent(初始化 -> 工作),onRender 在子类中覆盖时不会被调用。

Ext.define('My.custom.Component', {
extend: 'Ext.Component',
onRender: function() {
    this.callParent(arguments); // call the superclass onRender method

    // perform additional rendering tasks here.
    }
});

现代工具包的组件生命周期有什么变化吗?如果有,那是什么?

Here is the fiddle

【问题讨论】:

  • 我没有找到提到这个的地方;你能加个报价吗?今天晚些时候我会检查是否真的是这种情况,IMO 你应该能够像任何其他方法一样覆盖onRender
  • 检查现代和经典的小提琴......

标签: extjs extjs6 extjs6-modern


【解决方案1】:

您找到的指南刚刚从旧版本的 ExtJS 复制而来,其中不包含现代工具包;例如,the very same guide was already available in 4.2.2。尽管有相似之处,但这些概念并不完全适用于现代工具包。

似乎没有为这两个工具包调用单个事件或函数。除非绝对必要,否则我建议不要碰onRender 事件,因为它在现代没有对应物。使用“构造函数”(initComponent/initialize)或侦听器(afterrender/painted)。

您必须在 Sencha 论坛中询问这些差异是否会在 ExtJS 6.5 中得到解决。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-04-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-29
    • 2011-07-19
    相关资源
    最近更新 更多