访问模板中的 dijit widget 时 isValid 不是函数错误
我有一个 dijit validtextbox 小部件:
<input dojoAttachPoint="tbIPAddress" type="text" size="15" class="ipaddress"
dojoType="dijit.form.ValidationTextBox"
required="true"
regExp="^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$"
promptMessage="Enter IP Address."
invalidMessage="A valid IP Address is required." />
如果我给它一个 id,然后使用 dijit.byId 访问它,那么我可以对其调用 isValid 。但是,如果它位于 dijit 模板化小部件中并使用 dojoAttachPoint,那么当我使用 this.tbIPAddress 在关联的 js 类中访问它时,调用 isValid 会出现以下错误:
this.tbIPAddress.isValid 不是一个函数
我会假设这样做这。会足够聪明,知道是否在幕后执行 dijit.byId 或 dojo.byId ,并提供所有相关功能。我缺少什么?
I have a dijit validationtextbox widget:
<input dojoAttachPoint="tbIPAddress" type="text" size="15" class="ipaddress"
dojoType="dijit.form.ValidationTextBox"
required="true"
regExp="^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$"
promptMessage="Enter IP Address."
invalidMessage="A valid IP Address is required." />
If I give it an id and then access it with dijit.byId then I can call isValid on it. However, if it's in a dijit templated widget and is using dojoAttachPoint, then when I access it in the associated js class using this.tbIPAddress, calling isValid gives the following error:
this.tbIPAddress.isValid is not a function
I would assume that doing this. would be smart enough to know whether to do a dijit.byId or dojo.byId behind the scenes and would make available all the pertinent functions. What am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现,我的 dijit 模板化小部件类中缺少:
widgetsInTemplate: true,
I figured it out, I was missing in my dijit templated widget class:
widgetsInTemplate: true,