Expose Web Map Feature Table Properties in the Layer Specification

248
0
05-14-2023 02:48 PM
Status: Open
JustinReynolds
Occasional Contributor III

We should have more control over the behavior of the feature table in Web Map Viewer and on the data tab of the item.  This would extend beyond defining the column/field order and visibility.  This should be defined at the Layer or Table level and should be an extension of what is going on with the pop-up.

Inspecting the featureTable Spec in the ArcGIS JavaScript API provides some details.  

My idea is to add featureTableInfo property to the Layer & Table specs where we can then define the following items:
attachmentsEnabled, columnReorderingEnabled, editingEnabled, hiddenFields, multiSortEnabled, pageSize,& tableTemplate. tableTemplate is where we would define the column order and visibility.

Making this part of the Layer spec makes it portable to any web map and like everything else can be overridden by the web map.  Also, extremely important to all the work we do, this would provide a way to do this through automation rather than solely through the UI. It also could provide a way to prevent editing of fields on the data tab of the item.

Column visibility and order are important in the feature table, but so to is preventing access to the feature table all together... or allowing read-only access to the feature table.  We want our users collecting data using the Field Maps forms while preventing editing in the feature table because that flow skirts the purpose and logic of the form.

If the featureTableInfo property is not provided then the feature table uses default behavior and the field order, visibility, editability properties are inherited from fieldInfos property in popupInfo.  If fieldInfos or popupInfo are not provided then field order, visibility, editability properties are inherited from the layerDefinition. This would make introducing the property backwards compatible.

Similar posts:
Allow "Save layer" in Map Viewer to preserve field order as it did in Map Viewer Classic 
Map Viewer Popup Fields list - Add option to automatically sort fields other than alphabetically

@Tiff @ZoeBroek @RussRoberts 

Example JSON

 

{
  "layers": [
    {
      "id": 100011,
      "showLabels": true,
      "refreshInterval": 5,
      "blendMode": "normal",
      "effect": null,
      "featureTableInfo": {
        "attachmentsEnabled": true,
        "columnReorderingEnabled": true,
        "editingEnabled": false,
        "hiddenFields": ["objectid", "field1"],
        "multiSortEnabled": true,
        "pageSize": 100,
        "tableTemplate": {
          "columnTemplates": [
            {
            "type": "field",
            "fieldName": "objectid",
            "label": "OBJECTID",
            "direction": "asc",
            "initialSortPriority": 1,
            "sortable": true,
            "textAlign": "end",
            "visible": false
            },
            {
              "type": "field",
              "fieldName": "date",
              "label": "Service Date",
              "direction": null,
              "initialSortPriority": null,
              "editable": false,
              "required": true,
              "sortable": true,
              "textAlign": "start",
              "visible": true 
            },
            {
              "type": "field",
              "fieldName": "reportno",
              "label": "Service #",
              "direction": "asc",
              "initialSortPriority": 0,
              "editable": true,
              "required": true,
              "sortable": true,
              "textAlign": "center",
              "visible": false
            }
          ]
        }
      },
      "popupInfo": {
        "title": "Example",
        "fieldInfos": [
          {
            "fieldName": "objectid",
            "label": "OBJECTID",
            "visible": false
          },
          {
            "fieldName": "date",
            "format": {
              "dateFormat": "longMonthDayYear",
              "digitSeparator": false
            },
            "isEditable": true,
            "label": "Service Date",
            "visible": true
          },
          {
            "fieldName": "reportno",
            "isEditable": true,
            "label": "Report #",
            "visible": true
          }
        ]
      }
    }
  ]
}

 

 

Example feature | attribute table

JustinReynolds_0-1684102797383.png