@MatthewDriscoll Thank you for your reply, this is helpful. Just a question that came up while looking at this.
Here is a section of code that handles one of the query options on the page I'd like to update. Each of the search criteria has a separate block of code similar to this. I'm thinking that I may just be able to get away with reworking the few lines grid.set and grid.on towards the bottom of the code to use push the results to the vaadin grid or something similar?
/*** SEARCH BY PROJECT ***/
/* Query features from the observation layer */
view
.when(function () {
return obsLayer.when(function () {
var query = new Query();
query.where = "1=1";
query.outFields = ["PROJECT"];
query.returnDistinctValues = true;
query.orderByFields = ["PROJECT"];
return obsLayer.queryFeatures(query);
document.getElementById("doBtn").addEventListener("click", doQuery);
});
})
/* Call doQuery() each time the button is clicked */
view.when(function () {
// view.ui.add("optionsDiv", "top-right"); ****removed 6/22 CEP already added on line 790
document.getElementById("doBtn").addEventListener("click", doQuery);
});
/* Executes each time the button is clicked.
Clears results from prev. query then builds a new query.
Executes query and calls getResults() once promise is resolved. */
function doQuery() {
resultsLayer.removeAll();
params.where = "PROJECT =" + "'" + prjSelect.value + "' AND (VERIFIED = 1 OR VERIFIED = 2)";
loader.active = true;
obsLayer.queryFeatures(params).then(getResults).catch(promiseRejected);
}
/* Called each time promise is resolved.
Loop through each results and assign symbol and PopupTemplate */
function getResults(response) {
var prjResults = response.features.map(function (feature) {
feature.symbol = sym;
feature.popupTemplate = popupTemplate;
return feature;
});
resultsLayer.addMany(prjResults);
/* Populate DGrid Table at bottom of page with query results*/
var items = prjResults
var TableFeatures = []
array.forEach(items, function (feature) {
var TableAttributes = {}
var TableFields = Object.keys(feature.attributes)
for (var i = 0; i < TableFields.length; i++) {
TableAttributes[TableFields[i]] = feature.attributes[TableFields[i]]
}
TableFeatures.push(TableAttributes)
})
// array empty or does not exist
if (TableFeatures === undefined || TableFeatures.length == 0) {
loader.active = false;
myAlert.show();
}
var prjmemStore = new Memory({
data: TableFeatures,
idProperty: "OBJECTID"
});
grid.set("collection", prjmemStore);
grid.set("sort", "OBJECTID", true) // sorts objectID column - shows most recent 1st
grid.on("dgrid-select", selectedOBS);
grid.on('dgrid-deselect', clearonChange);
/* Zoom to Extent */
var AOI = response.features;
view.goTo(AOI);
}
/* Called each time promise is rejected */
function promiseRejected(error) {
console.error("Promise rejected: ", error.message);
}