Select to view content in your preferred language

Autocast all fields in FeatureTable

645
2
Jump to solution
10-12-2021 08:10 AM
JeffreyThompson1
Emerging Contributor

The purpose of the FeatureTable I am building is to display unedited data from a public source. According to the documentation, leaving the fieldConfigs blank will autocast all of the fields which is exactly the behavior I want.

JeffreyThompson1_0-1634051148791.png

Here is my super simple code:

const featureTable = new FeatureTable({
		view: view,
		layer: layer,
		container: "viewDiv",
	});

And all I'm getting is the table header:

JeffreyThompson1_1-1634051282340.png

How can I get the columns to Autocast?

0 Kudos
1 Solution

Accepted Solutions
JeffreyThompson1
Emerging Contributor

Apparently, this was a CSS issue. The data was being autocast correctly, but put into a div with 0px height.

I was able to solve the problem by adding this to my CSS file.

.esri-feature-table__content {
	min-height: 200px !important;
}

View solution in original post

0 Kudos
2 Replies
ReneRubalcava
Honored Contributor

Do you have the layer to test you are expecting to use?

This sample works without defining the fieldConfigs

https://codepen.io/odoe/pen/yLoydBb?editors=1000

 

Autocast means you don't need to new up an instance of the FieldColumnConfig, just pass an object that has the constructor properties. 

https://developers.arcgis.com/javascript/latest/programming-patterns/#autocasting

 

Does your layer have fields other than the ones it says will not be included automatically?

0 Kudos
JeffreyThompson1
Emerging Contributor

Apparently, this was a CSS issue. The data was being autocast correctly, but put into a div with 0px height.

I was able to solve the problem by adding this to my CSS file.

.esri-feature-table__content {
	min-height: 200px !important;
}
0 Kudos