如何为这个 dojo 小部件编写函数

发布于 2024-10-01 05:43:45 字数 201 浏览 0 评论 0原文

我刚刚创建了这个 dojo 小部件,现在我想向它附加一个事件,我可以看看它是如何完成的:

var filteringSelect = new dijit.form.FilteringSelect({
        id: "test",
    },
    "test");

我想向它附加一个 onfocus 函数。

I just created this dojo widget and now I want to attached an event to it can I see how it is done:

var filteringSelect = new dijit.form.FilteringSelect({
        id: "test",
    },
    "test");

I want to attached an onfocus function to it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

回眸一笑 2024-10-08 05:43:45

这几乎是您需要阅读的全部内容。

编辑:你可能会发现这个 Dojo 和 Dijit 的入门教程很有用,尤其是这个示例。

EDIT2:更具体地说,您需要做的就是:

dojo.connect(dijit.byId("ID_OF_YOUR_WIDGET"), "onBlur" , yourCallBackFunctionAndBeCarefulWithScoping);

It's pretty much all you need to read.

EDIT: you might find this introductory tutorial to Dojo and Dijit useful, especially this sample.

EDIT2: To be more specific, all you need to do is:

dojo.connect(dijit.byId("ID_OF_YOUR_WIDGET"), "onBlur" , yourCallBackFunctionAndBeCarefulWithScoping);
季末如歌 2024-10-08 05:43:45
var filteringSelect = new dijit.form.FilteringSelect({
    id: "test",
onFocus :function(){/*handler for onFocus */}
},
"test");

请注意 onFocus 中的大写 F,如果您使用 onfocus,则无法正常工作。

var filteringSelect = new dijit.form.FilteringSelect({
    id: "test",
onFocus :function(){/*handler for onFocus */}
},
"test");

Note the CAPITAL F in onFocus, if you use onfocus things wont work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文