November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Also, when I try to use i.e. require inside a script tag in a view, I get that "required is not defined.". Didn't EPiServer do the dojo loading for me?
Hi!
What do you mean with a view in this case? You need to create a widget in order to use the Dojo functionality. If you have used for instance the IFrameComponent-attribute you will not get Dojo loaded inside your page.
I have created a widget and I have not used in iframecomponent-attribute. With a view I mean the views you create in the mvc projects, the v. I have my models, controllers and views.
Inside my view I have this parts related to dojo:
<script> require(['dojo/parser', 'mycomponents.test_in_page', 'dijit/domReady!'], function (parser) { parser.parse() }); </script>
<div data-dojo-type="mycomponents.test_in_page">This should be replaced.</div>
But the div does not get replaced, becase when I load the page (in edit mode), the console logs an error saying that "require is not defined". Require is defined by dojo, so is it possible that episerver has not loaded dojo yet?
require is defined by dojo when dojo is loaded. It's still not quite clear where your view is. I guess what Linus was trying to say is that dojo is only automatically loaded for you in an EPiServer view; e.g. the edit view or the dashboard view. In order to plug into one of these views you need to create a component to host your widget.
Also just one comment on your script. When you require modules it should always be slash notation; e.g. 'mycomponents/test_in_page'
I've been looking around in the sdk and found a lot of episerver widgets, but not so much on how to use them. I've tried the way I would use a dojo/form/Button but I've had no success. I suspect that either the tag I'm using (div) is not correct, i.e. <div data-dojo-type="epi.shell.widget.DateTimeSelector"></div> (DateTimeSelector was just a widget I tried), or there just are no styling and thus I can't see the widgets. So I was wondering where in the sdk I could read about this? I have had a hard time finding it there my self. Thanks for your help!