[Dojo-interest] How to setup my own widgets
Gert van Spijker
gert at ab-graph.com
Mon Aug 21 14:57:09 MDT 2006
If you use Firefox with Firebug you can see the GET requests made for
the template files. In my case it was very easy to see that my relative
path was wrong.
Ole wrote:
>Any tips on what path to use when looking for the template?
>
>Dojo widgets usually do
>
>dojo.uri.dojoUri("src/widget/templates/TitlePane.html"),
>
>And I tried using a relative path like
>../../com/path/to/my/template/folder/template.html
>
>(Note that I also use ../../com/...to load the widget package, so I'm
>following the same convention used
>to illustrate package loading outside of dojo, and everything works until I
>try to load the template)
>but I get an error like this:
>
>DEBUG: failed loading ...
> [TypeError: dojo.widget.html has no properties, file: file:///.../dojo.js,
>line: 299]
>
>Thanks,
>- Ole
>
>
>Josh Reed wrote:
>
>
>>Writing the actual widget is the same as described in the Fast Widget
>>Authoring article
>>(http://dojotoolkit.org/docs/fast_widget_authoring.html) except that
>>you use a directory structure and package outside of the dojo name
>>space e.g.
>>
>>dojo.provide("xqi.widget.XQISearch");
>>dojo.provide("xqi.widget.HtmlXQISearch");
>>
>>// The XQI Search widget displays a dynamically generated search interface
>>xqi.widget.HtmlXQISearch = function() {
>>...
>>}
>>
>>This would be placed in a directory structure external to dojo's e.g.
>>
>>dojo/
>> src/
>>xqi/
>> widget/
>> XQISearch.js
>>
>>Then the trick to getting these widgets to show up in your page is to
>>tell dojo about your external directories in the script tag at the top
>>of your webpage:
>>
>>dojo.hostenv.setModulePrefix('xqi', '../xqi');
>>dojo.require('dojo.widget.*');
>>dojo.widget.manager.registerWidgetPackage('xqi.widget');
>>
>>dojo.require('xqi.widget.XQISearch');
>>
>>Then you can use the tags/dojoType that you assigned in you JS file to
>>create the widget.
>>
>>Thanks,
>>Josh
>>
>>
>>
>>
>>
>>On 12/6/05, Simon Matthews <sam at knowledgepool.com> wrote:
>>
>>
>>>I have started to use dojo and want to create some of my own interface
>>>widgets whilst I am testing my application. I may release these later
>>>if I
>>>can get clearance for that. But my question is how best to set this up.
>>>Ideally I want to create my widgets in their own directory so that I
>>>don't
>>>risk clashing with new widgets that are added. Currently if I create my
>>>own
>>>widget and put it in a subdirectory of src/widgets then I can include it
>>>using:
>>>
>>>dojo.require("dojo.widget.subdir.test");
>>>
>>>But what do I set the addParseTreeHandler line to?
>>>
>>>I have tried
>>>
>>>Dojo.widget.tags.addParseTreeHandler("dojo:subdir.test");
>>>
>>>Which doesn't work
>>>
>>>I have looked at the dojo.widget.tags code and it looks like this may not
>>>be
>>>implemented. Can someone tell me if this is supposed to work.
>>>
>>>Thanks
>>>
>>>sam
>>>_______________________________________________
>>>Dojo-interest mailing list
>>>Dojo-interest at dojotoolkit.org
>>>http://dojotoolkit.org/mailman/listinfo/dojo-interest
>>>
>>>
>>>
>>>
>>>
>>_______________________________________________
>>Dojo-interest mailing list
>>Dojo-interest at dojotoolkit.org
>>http://dojotoolkit.org/mailman/listinfo/dojo-interest
>>
>>
>>
>>
>
>
>
More information about the Dojo-interest
mailing list