Select to view content in your preferred language

How to set up the config.json of the attribute table widget for several map services?

2215
6
Jump to solution
02-13-2020 02:06 AM
DávidGregor
Emerging Contributor

I'm new in the ESRI community, and also novel in editing services. We have like 40 map services with almost the same layer list. The whole service was made in WAB 2.4. But now i wanted to use the capabilities of the WAB 2.15.

Is it possible to mix the versions in one config file? Do i need to copy/refresh addittional files?

In the WAB I set up the attribute table widget for one map service, and i got a json with hardcoded layers. 

What should i do to make the widget working for all the 40 map services? Should i expand the layer list with ~300 layers by hand, or there is some dynamic solution?

json sample:

{ "name": "Feature class name", "id": "map_service_1111_11", "layer": { "url": "https://domain/arcgis/rest/services/map_service/MapServer/11" }, "show": true, "showAttachments": false, "sortField": "SORTFIELD", "isDescending": false },

And in the main confin.json in have list for map service changer. Here is a section of that.

"map": {
"3D": false,
"2D": true,
"position": {
"left": 0,
"top": 40,
"right": 0,
"bottom": 0
},

"itemId": "2ed44b3634gdf3f5e5",
"mapOptions": {},
"id": "map",
"portalUrl": "https://domain.local/portal",

"MapService1": {
"itemId": "2ed4463463w4twggdxgdg"
},
"MapService2": {
"itemId": "htfjhxzjzdygyr43tgxrr5h"
},

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Normally, minus any customization for adding layer or switching the map layers at runtime, the AT widget will automatically list all the layers in the map (without any configuration). You would only normally need to configure layers that you want to limit the fields shown or something.

View solution in original post

0 Kudos
6 Replies
RobertScheitlin__GISP
MVP Emeritus

Dávid,

  Your best bet is to start with a fresh app. There is a lot of code and even configuration files that have changed from 2.4 to 2.15. As far as configuring the layers in the attribute table widget. The attribute table widget has a settings dialog in WAB that has a nice Graphical User Interface (GUI) that allows you to make all the configurations without having to edit json directly.

DávidGregor
Emerging Contributor

Robert,

Thank you for your response. I rebuilt the app, and fully syncronised with the old webapp. So i built in every custom widget, and i added the mapIDs. But i still have a hardcoded attribute table widget. 

Maybe i (and my ancestor) misunderstand the whole system, and thats why they built a custom Change widget with predefined mapservice list with IDs, what uses jimu.js/mapmanager.js to change between maps inside the webapp. 

I dont know how to accomplish this in WAB. And i couldn't import the custom widget succesfully. But i could deploy my new webapp to the portal. And its working. 

But how would you make the the attribute table widget, to load every mapservice's attribute table? Should i write a js code, or can i solve it in json?

Every mapservice has the same type of feature classes, just some of them has less. But i can make a full list for a request. Do you have any idea?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Normally, minus any customization for adding layer or switching the map layers at runtime, the AT widget will automatically list all the layers in the map (without any configuration). You would only normally need to configure layers that you want to limit the fields shown or something.

0 Kudos
DávidGregor
Emerging Contributor

Ok, now a realised my mistake. Thank that you pointed on it. shouldn't have given json parameters(set up the AT widget). Is there any json option to query for layers to show (in my situation to now show).?

0 Kudos
DávidGregor
Emerging Contributor

Any idea what can be messed in my maps: if i click on: "zoom to"

The map is shared with a national coordinate system. And the features are points

TypeError: Cannot read property 'getWidth' of null
at Object.graphicsExtent (init.js:1952)
at Object.mo.graphicsExtent (zoomToUtils.js?wab_dv=2.15:138)
at Object.mo.zoomToFeatureSet (zoomToUtils.js?wab_dv=2.15:39)
at Object.selectFeatures (_FeatureTable.js?wab_dv=2.15:2395)
at Object._goToFeatures (_FeatureTable.js?wab_dv=2.15:2727)
at Object._zoomToSelected (_FeatureTable.js?wab_dv=2.15:2713)
at Object.zoomTo (_FeatureTable.js?wab_dv=2.15:638)
at Object.onClick (init.js:64)
at Object._onClick (init.js:393)
at HTMLInputElement.<anonymous> (init.js:64)

mo.graphicsExtent = function(graphicsParam, /* optional */ factor){
var ext = null;
try {
var graphics = graphicsParam;
if(graphics &&
graphics.length === 1 &&
graphics[0].geometry &&
graphics[0].geometry.declaredClass === "esri.geometry.Multipoint" &&
graphics[0].geometry.points.length === 1) {

var mPoint = graphics[0].geometry.points[0];
var point = new Point(mPoint[0], mPoint[1], graphics[0].geometry.spatialReference);
graphics = [new Graphic(point)];
}

if(graphics && graphics.length === 1 &&
graphics[0].geometry &&
graphics[0].geometry.declaredClass === "esri.geometry.Point") {
var geometry = graphics[0].geometry;
ext = new Extent(geometry.x - 0.0001,
geometry.y - 0.0001,
geometry.x + 0.0001,
geometry.y + 0.0001,
geometry.spatialReference);
ext.isSinglePoint = true;
} else if(graphics && graphics.length > 0){
ext = graphicsUtils.graphicsExtent(graphics);
if (ext) {
if(typeof factor === "number" && factor > 0){
ext = ext.expand(factor);
}
}
}
} catch (e) {
console.error(e);

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

In a normal scenario when a new layer is added to the map (say using the Add Data widget) then the layer will not show in the AT widget until choose the "View in attribute table" option from the Layer List widgets layer menu.

0 Kudos