ListView Widget Help

748
24
12-17-2019 03:08 PM
SamLee1
New Contributor
0 Kudos
24 Replies
KenBuja
MVP Honored Contributor

Sam, if this has answered your question, please click the Mark Correct on the post that helped you.

As a reminder, you have started several discussions which garnered many answers. If those have been sufficiently answered, please mark the appropriate posts as correct. This will help others as they search for answers on similar questions.

0 Kudos
SamLee1
New Contributor

I have tried that and still get an error:

Nothing shows up on select layer, thumbnail, and title. Attached is the modified code based on your 5 lines.

0 Kudos
KenBuja
MVP Honored Contributor

The order of the require modules doesn't match the order of the function arguments. Since you haven't provided an argument for "dijit/form/Select", you have to move that after "jimu/dijit/Message".

define([
"dojo/_base/declare",
"jimu/BaseWidgetSetting",
"dojo/_base/lang",
"dojo/_base/array",
"dijit/_WidgetsInTemplateMixin",
"jimu/LayerInfos/LayerInfos",
"jimu/dijit/Message",
"dijit/form/Select"
], function (
declare,
BaseWidgetSetting,
lang,
array,
_WidgetsInTemplateMixin,
LayerInfos,
Message
) {

Upon further testing, this.config will also not get created if you add a map that has only a map service and not a feature layer. It returns a value of "ArcGISMapServiceLayer". You can test for this by adding lines 9-14 instead of the test from my last post

array.forEach(infos, function (info) {
if (info.originOperLayer.layerType === "ArcGISFeatureLayer") {
options.push({
label: info.title,
value: info.id
});
}
});
if (options.length == 0) {
new Message({
type: "error",
message: "There are no valid feature layers in this map!"
});
}
this.layerSelect.set("options", options);‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Note that this just warns your about not having any feature layers. If you go ahead and configure the widget without the layers, you'll still get that error when trying to use the widget. But then, why would you configure the app to use the widget without any feature layers?

0 Kudos
SamLee1
New Contributor

Okay thanks for all the help. 

0 Kudos
JonathanMori1
New Contributor III

Is there a way to not need to specify a picture Icon in this widget and just have another data field?

0 Kudos