Login Register

[solved] ${...} is giving an error message

I'm using the code from http://dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-... to try and get my own widget working. The main problem I am having is using the exact code from there or my own I get this error:

[Exception... "'Error: dojoc.widget.ImageAccordion template:src' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "" data: no]

AFAIK I have included all the files I should need to include. I would also point out that the documentation for this is awful.

The code:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Project</title>
<style type="text/css">
   @import "dojo-1.1.0/dijit/themes/tundra/tundra.css";
   @import "dojo-1.1.0/dojo/resources/dojo.css";
  </style>
<script type="text/javascript" src="dojo-1.1.0/dojo/dojo.js" djConfig="parseOnLoad: true, usePlainJson: true "></script>
<script type="text/javascript">
      dojo.require("dojo.parser");
      dojo.require("dijit.Declaration");
      dojo.require("dijit.layout.AccordionContainer");
</script>
</head>

<body class="tundra">
<div dojoType="dijit.Declaration"
       widgetClass="dojoc.widget.ImageAccordion"
       mixins="dijit.layout.AccordionPane"
>
<div class='dijitAccordionPane'
      >
<div dojoAttachPoint='titleNode,focusNode'
                dojoAttachEvent='ondijitclick:_onTitleClick,onkeypress:_onKeyPress'
                class='dojocAccordionTitle' wairole="tab"
                >
<div class='dijitAccordionArrow'></div
                >
<div class='arrowTextUp' waiRole="presentation">?</div
                >
<div class='arrowTextDown' waiRole="presentation">?</div
                >
<span dojoAttachPoint='titleTextNode'><img alt="${title}" src="${src}"
        >
</span></div
        >
<div><div dojoAttachPoint='containerNode'
                style='overflow: hidden; height: 1px; display: none'
                dojoAttachEvent='onkeypress:_onKeyPress'
                class='dojocImageAccordionBody' waiRole="tabpanel"
        >
</div></div>
  </div>
</div>

<div dojoType="dojoc.widget.ImageAccordion"  title="blah1" src="images/star.png">Text of blah</div>

I tried it...

...and got a different error than the one you are finding (m._findMixin is not defined). I'm not sure why I'm seeing that, or why you're seeing what you're seeing.

Hopefully someone who worked on the Declaration stuff can chime in, but it may be that you're just missing something small.

After playing around with

After playing around with the direct extension method I found that if you add a ?: "" line for the word you use in the tag it works fine, so if you want to use ${title} in the template you need a title: "" line in the js code.