Select to view content in your preferred language

LoadingShelter question

2168
9
Jump to solution
09-29-2017 08:41 AM
KenBuja
MVP Esteemed Contributor

I've having some difficulty with the LoadingShelter when I'm adding that into the Widget.html file. I have put it in there as

<div>
  <div>
    widget content
  </div>
  <div data-dojo-type="jimu/dijit/LoadingShelter" data-dojo-attach-point="shelter" data-dojo-props="hidden:true" style="overflow:hidden;"></div>
</div>
‍‍‍‍‍‍

However, when I attempt to show or hide it with

this.shelter.show();

I get the error "TypeError: this.shelter.show is not a function".

If I look at examine it in another widget, say the eSearch widget, its properties are

When I examine it in my widget, its properties are

What am I getting wrong about the implementation?

I have also tried adding the LoadingShelter in Widget.js programmatically in the postCreate function

    this.shelter = new LoadingShelter({
      hidden: true
    });
    this.shelter.placeAt(this.domNode);
    this.shelter.startup();
 

When I examine it in Developer Tools, its properties are similar to the eSearch version, but I never actually see it show up on my widget

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Ken,

  You are missing the _WidgetsInTemplateMixin from your widget declare array.

Line 2 of your Widget.js:

return declare([BaseWidget], {
//Should be
return declare([BaseWidget, _WidgetsInTemplateMixin], {

View solution in original post

9 Replies
RobertScheitlin__GISP
MVP Emeritus

Ken,

  Do you have the require for 'dijit/_WidgetsInTemplateMixin', in your Widget.js and

return declare([BaseWidget, _WidgetsInTemplateMixin], {

in your Widget.js?

0 Kudos
KenBuja
MVP Esteemed Contributor

Yes, both of those are in there. If I put the this.shelter.show(); in the postCreate, it does show up.

  postCreate() {
    this.inherited(arguments);
    //LoadingShelter
    this.shelter = new LoadingShelter({
      hidden: true
    });
    this.shelter.placeAt(this.domNode);
    this.shelter.startup();
    this.shelter.show();

0 Kudos
KenBuja
MVP Esteemed Contributor

Actually, I was hiding it too soon, before the heavy lifting in the function. So when it's added programmatically, it works fine. But why won't it work when using the attach point in the html file?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Ken,

   Before you added it programattically did you have the require for "jimu/dijit/LoadingShelter"? The fact that the this.shelter is complaining it does not have a show method tells me that the div is not actually getting assigned a the LoadingShelter dijit. Which normally happen when the dijit is not imported (required) properly or the widget does not have the _WidgetsInTemplateMixin.

0 Kudos
KenBuja
MVP Esteemed Contributor

Yes, the 'jimu/dijit/LoadingShelter' module has been in the require since the beginning.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

I'm not sure what to tell you. You want me to look over the full Widget.js and Widget.html for you?

0 Kudos
KenBuja
MVP Esteemed Contributor

That would be kind of you.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Ken,

  You are missing the _WidgetsInTemplateMixin from your widget declare array.

Line 2 of your Widget.js:

return declare([BaseWidget], {
//Should be
return declare([BaseWidget, _WidgetsInTemplateMixin], {
KenBuja
MVP Esteemed Contributor

Thanks, Robert, that was it.

0 Kudos