【问题标题】:dojo custom widget onshow event howtodojo 自定义小部件 onshow 事件 howto
【发布时间】:2014-09-05 19:18:12
【问题描述】:

按照我的自定义小部件的代码。 除了“onShow”事件之外,一切正常。

有没有办法将事件“onShow”添加到自定义小部件?

谢谢!

类:

define(["dojo/_base/declare","dijit/_WidgetBase", "dijit/_TemplatedMixin", "dijit/_WidgetsInTemplateMixin"
,"dojo/text!./templates/testWidget2.html"
],
function(declare, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin
    ,template
){
return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin ], {

    templateString: template,

    onShow: function() {
        console.info("testW2 onShow")
    }         

});
});

模板:

<div class="${baseClass}" style="border:solid 1px green;">
<h1>W2</h1>
</div>

【问题讨论】:

  • 查看this 链接以将自定义事件添加到自定义小部件。
  • 不幸的是,该链接没有回答我的问题。我需要的应该已经作为继承自 _widgetBase 存在,但它不起作用......

标签: dojo dijit.layout


【解决方案1】:

尝试使用:

this.inherited(arguments)

在声明的 postCreate 和启动部分。

如:

startup: function(){
  trace("startup"); // helps you trace it in the console
  this.inherited(arguments);
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-09-03
    • 2012-03-07
    • 2011-11-25
    • 1970-01-01
    • 2013-07-22
    • 2010-12-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多