FeatureTable - How to check-off some columns before loading into the table

800
2
Jump to solution
03-22-2021 09:24 AM
ShaningYu
Frequent Contributor

I loaded an excel file and then converted it as a FeatureTable.  I want to turn off some fields (or columns, e.g OBJECTID) when the table is loaded. 

0 Kudos
1 Solution

Accepted Solutions
JeffreyWilkerson
Occasional Contributor II

Set up a field list and specify how to show/handle specific columns:

 

var lstFields = [
    { name: OBJECTID, visible: false },
    { name: "StopID", label: "Stop ID: ", direction: "asc", editable: false },
    { name: "Location", label: "Bus Stop Location: " },
    { name: "Routes", label: "Routes Served: ", direction: "asc"},
    { name: "Jurisdiction", label: "Jurisdiction: ", required: true }
]

 

Then, when you define the FeatureTable you can use this field list for the 'fieldConfigs' value:

 

busStopViewTable = new FeatureTable({
    view: view,
    layer: busStopsLayer,
    editingEnabled: true,
    menuConfig: {
        items: [{
            label: "Zoom to feature(s)",
            iconClass: "esri-icon-zoom-in-magnifying-glass",
            clickFunction: function (event) {
                //zoomToSelectedFeatureTable();
                   console.log("Need to build zoomToSelectedFeatureTable function");
            }
        }]
    },
    // Autocast the FieldColumnConfigs
    fieldConfigs: lstFields,
    container: document.getElementById("tableDiv")
});

 

View solution in original post

2 Replies
JeffreyWilkerson
Occasional Contributor II

Set up a field list and specify how to show/handle specific columns:

 

var lstFields = [
    { name: OBJECTID, visible: false },
    { name: "StopID", label: "Stop ID: ", direction: "asc", editable: false },
    { name: "Location", label: "Bus Stop Location: " },
    { name: "Routes", label: "Routes Served: ", direction: "asc"},
    { name: "Jurisdiction", label: "Jurisdiction: ", required: true }
]

 

Then, when you define the FeatureTable you can use this field list for the 'fieldConfigs' value:

 

busStopViewTable = new FeatureTable({
    view: view,
    layer: busStopsLayer,
    editingEnabled: true,
    menuConfig: {
        items: [{
            label: "Zoom to feature(s)",
            iconClass: "esri-icon-zoom-in-magnifying-glass",
            clickFunction: function (event) {
                //zoomToSelectedFeatureTable();
                   console.log("Need to build zoomToSelectedFeatureTable function");
            }
        }]
    },
    // Autocast the FieldColumnConfigs
    fieldConfigs: lstFields,
    container: document.getElementById("tableDiv")
});

 

ShaningYu
Frequent Contributor

Perfect!  Thanks A LOT!

0 Kudos