Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

EPiServers dijit widgets

Vote:
 

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!

#63345
Nov 15, 2012 14:32
Vote:
 

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?

#63346
Nov 15, 2012 14:46
Vote:
 

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.

#63354
Nov 15, 2012 17:11
Vote:
 

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?

 

#63371
Nov 16, 2012 9:40
Vote:
 

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'

#63440
Nov 20, 2012 9:32
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.