ListView Widget Help

2026
24
12-17-2019 03:08 PM
SamLee1
New Contributor
0 Kudos
24 Replies
SamLee1
New Contributor

When I hover over my this.config is shows undefined.

0 Kudos
KenBuja
MVP Esteemed Contributor

Can you post the entire directory so I can take a look at it?

0 Kudos
SamLee1
New Contributor

0 Kudos
KenBuja
MVP Esteemed Contributor

I'm sorry, I meant post the zipped widget files so I can open and run it.

0 Kudos
SamLee1
New Contributor

No icon to upload zip file.

0 Kudos
KenBuja
MVP Esteemed Contributor

You have to use the reply from the discussion itself, not from the Inbox. You'll see the "Use advanced editor" link in the upper right.

0 Kudos
SamLee1
New Contributor

Attached is the zipped file for the code.

0 Kudos
KenBuja
MVP Esteemed Contributor

The widget works properly for me, with this.config getting populated properly and the layer instantiated.

In your app, have you added a map and selected a layer in the widget settings?

0 Kudos
SamLee1
New Contributor

Yes I used the default map and layer. Is there a specific one that you used?

How did you get to the Configure ListView window?

I just realized that you are on the server not the client. 

This is what I get:

But after I click okay and the widget this happens:

0 Kudos
KenBuja
MVP Esteemed Contributor

Your problem is that your map doesn't have any layers. It needs at least one layer to properly make "this.config". I tested with an empty map and got that same error.

Your remedy would be to check to see if there are layers in your map. You could add line 10-15 to your Settings.js file (adding in the module and argument for Message)

define([
 ...
 "jimu/dijit/Message"
],
  function(..., Message) [

      LayerInfos.getInstance(this.map, this.map.itemInfo).then(
        lang.hitch(this, function (layerInfosObj) {
          var infos = layerInfosObj.getLayerInfoArray();
          if (infos.length == 0) {
            new Message({
              type: "error",
              message: "Your map must have at least one layer!"
            });
          }