AnsweredAssumed Answered

Feature Table doesn't show records

Question asked by MollyKFoley on May 7, 2018
Latest reply on May 7, 2018 by MollyKFoley

I've never created a feature table before so I'm sure I'm just missing something small, but when I implement the Feature Table widget it loads in the appropriate place but doesn't show any records. I've tried a few different things, but nothing has worked yet. 

 

Currently, my code looks like this:

//Add the habitat patches feature layer
var patchesFL = new FeatureLayer("URL", {
    refreshInterval: 10,
    definitionExpression: 'EXTRACT(YEAR FROM "ObsvDate") = ' + currentYear,
    visible: false,
    infoTemplate: patchesPopupBox,
    outFields: ["*"]
});
patchesFL.setMinScale(500000);

//Add the feature layers to the map object
map.addLayer(patchesFL);

//Create attribute table
var attrTable = new FeatureTable({
    featureLayer: patchesFL,
    editable: false,
    outFields: ["StateID", "Point", "PatchNum", "IsDeveloped", "CropTypeID", "CropResidue", "CnpyOver12",
        "CnpyDecid", "CnpyConif", "ShrubCover", "ShbHiStemsDens", "GrassCover", "ForbCover",
        "FrbAsProtect", "ForbSpecies", "BareGround", "HerbHeight", "Overstory",
        "Understory", "OfficialQH", "ObsvDate", "ObsvType"],
    map: map
}, "attribute-table");
attrTable.startup();

 

I have attempted to add this line because I saw it in a bunch of examples, and changed the visibility property to true when instantiating the feature layer:

mode: FeatureLayer.MODE_ONDEMAND,

 

I have also tried changing the feature table options to be in quotes because I found it done both ways in the documentation and wasn't sure which was right:

//Create attribute table
var attrTable = new FeatureTable({
    "featureLayer": patchesFL,
    "editable": false,
    "outFields": ["StateID", "Point", "PatchNum", "IsDeveloped", "CropTypeID", "CropResidue", "CnpyOver12",
        "CnpyDecid", "CnpyConif", "ShrubCover", "ShbHiStemsDens", "GrassCover", "ForbCover",
        "FrbAsProtect", "ForbSpecies", "BareGround", "HerbHeight", "Overstory",
        "Understory", "OfficialQH", "ObsvDate", "ObsvType"],
    "map": map
}, "attribute-table");
attrTable.startup();

 

None of these changes have affected anything. I have made sure to zoom into my map to the appropriate extent where the feature layer is visible to see if that did the trick, it doesn't. 

 

Do I need to have records selected in order for anything to show up in the table? This is what I get when the map loads, you can see the Feature Table widget exists based on the ability to turn on/off fields but no records show up:

Outcomes