Is it possible to query server-side FeatureTable without re-creating FeatureLayer?
I got a solution:
1. Create FeatureLayer:
let featureLayer= new FeatureLayer({
You can bring it in as a FeatureLayer and query it the same as you would as a feature layer.
const bldPermLayer = new FeatureLayer({ url: "https://.../server/rest/services/...", outFields:["*"] }); const featureTable = new FeatureTable({ view: theView, layer: bldPermLayer, }); function handleQueryResults() { let queryBP = bldPermLayer.createQuery(); queryBP.where = "query" queryBP.outFields = ["*"]; // do the query bldPermLayer .queryFeatures(queryBP) .then((response) => { // code }); }
@MatthewDriscoll
Thank you for your help!
Is it possible that FeatureTable get updated automatically when querying FeatureLayer?
What do you mean? Are trying to edit a FeatureTable through a query?
function handleQueryResults() { let queryBP = bldPermLayer.createQuery(); queryBP.where = "query" queryBP.outFields = ["*"]; // do the query bldPermLayer .queryFeatures(queryBP) .then((response) => { // code }); }
The response is FeatureSet, right? How to update FeatureTable using the response? Or FeatureTable got updated already?
Thanks.
Forrest
Do what you want with it in the code. It's the same data so it could go something like below.
function handleQueryResults() { let queryBP = bldPermLayer.createQuery(); queryBP.where = "query" queryBP.outFields = ["*"]; // do the query bldPermLayer .queryFeatures(queryBP) .then((response) => { featureTable.selectRows(response.features); featureTable.filterBySelection(); }); }
The question was how to do it without definitionExpression. So marking your solution as the correct one, by using definitionExpression, is a bit miss leading for those searching for the same thing in the future.
After FeatureTable with FeatureLayer is created,
call
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.