Reputation: 41
I have created a custom widget for showing tooltip while u click on a icon. When i add this template of other widget I am getting " dojo/parser.js:900 dojo/parser::parse() error Error: Unable to resolve constructor for: 'CustomPopup' " following error. I am attaching my code here. CustomPopup is the widget for showing tooltip. (both html and js are in same directory)
CustomPopup.html
<span id="${id}" data-dojo-attach-event="onclick: myClickHandler, mouseout: myMouseOut"></span>
CustomPopup.js
define([
'dijit/_WidgetBase',
'dijit/_TemplatedMixin',
'dijit/_WidgetsInTemplateMixin',
'dojo/_base/declare',
'dojo/on',
'dijit/registry',
'dijit/TooltipDialog',
'dijit/popup',
'dojo/mouse',
'dojo/dom',
'dijit/_AttachMixin',
'dojo/text!./CustomPopup.html',
'dojo/parser'
],function( _WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin, declare,on,registry,TooltipDialog,popup,mouse,dom,_AttachMixin,htmlTemplate,
parser)
{
return declare([_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,TooltipDialog],{
templateString : htmlTemplate,
myClickHandler: function(e){
console.log('hiiii');
},
myMouseOut: function(){
console.log('bhhhh');
},
_toolTipDialog : null
});
});
I am adding this widget to another widget to get tooltip, that HTMLtemplate is
somewidget:
<div id="mainId" data-dojo-type="dijit/layout/ContentPane" style="width:100%; height:100%">
<div data-dojo-type="dijit/form/TextBox" data-dojo-props='diaplayedValue:"10"' id="jet" style="background-color: red;"></div>
<div data-dojo-type="dijit/form/TextBox" data-dojo-props='displayedValue:"20"' id="jet1" style="background-color: blue;"></div>
<div data-dojo-type="CustomPopup" id="klm"></div>
</div>
I am getting the below error: enter image description here
so ,could someone pls help to fix my error.
Upvotes: 0
Views: 275
Reputation: 234
You should never use id for dojo widgets. Use data-dojo-attach-point instead
Upvotes: 0