I am going through this tutorial and I keep getting this error:
Tutorial: Create a ListView widget—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers
Attached is the code.
When I hover over my this.config is shows undefined.
Can you post the entire directory so I can take a look at it?
I'm sorry, I meant post the zipped widget files so I can open and run it.
No icon to upload zip file.
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.
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?
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:
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!"
});
}