I have this simple query and want to display the results to a feature table. However, the table never appears. I believe the root of the issue is the async. So, I tried using promises to no avail. I verified that the query works and I can see results on the map and the label about the number of features found.
getQuery = async (SQLwhere) => {
let thelayer = this.state.LayerObject;
let query = thelayer.createQuery();
query.where = SQLwhere;
let thevalues = [];
query.outFields = ["*"];
query.returnDistinctValues = false;
query.returnGeometry = true;
thelayer
.queryFeatures(query)
.then((results) => {
numberofgraphics = results.features.length;
const featureTable = new FeatureTable({
view: this.state.jimuMapView.view,
layer: thelayer,
container: this.tableRef.current,
});
let graphics = results.features;
numberofgraphics = graphics.length;
In html
<div>
<Label
id="results"
size="sm"
style={{ fontSize: 14, fontWeight: "bold", color: "red" }}
>
There are {numberofgraphics} feature(s) found.
</Label>
<div
id="tableDiv"
style={{
marginTop: "10px",
marginLeft: "10px",
width: "440px",
height: "300px",
}}
ref={this.tableRef}
/>
</div>