Multiple layers selection

347
2
08-26-2021 02:54 AM
Vakhtang_Zubiashvili
Occasional Contributor II

Hello guys,

Here is what i try now to do: i want to select multiple layers e.g. by rectangle, i use this sample to select features, but how to do with multiple layers i do not know.

Just need to select multiple layers features at once, get their attributes to show them in table ( add attributes to table i have done already for my other project).

Any other solution, suggestion or advise that might be helpful will be appreciate .

 

Thank you very much.

0 Kudos
2 Replies
JeffreyWilkerson
Occasional Contributor II

Just like in the example, you are going to have to use the drawn box (polygon) and do a 'featureLayer.queryFeatures' on all of the layers that you add to your map.  The hard part is going to be what you do with it afterwards, as I believe the FeatureTable that's being used can only attach to one featureLayer at a time.   

You could get the results for each featurelayer, push them into one JSON string, and then use something like Dojo's 'dGrid' to display them, that would be a lot of work but you would have full control over it.  You could also take each result and write out the table in HTML (<table><tr><td>fieldname</td><td>field value</td></tr></table>) and stuff it back into the page.  

If you have access to the new Experience Builder, you could create a page with a map, add all of  your layers, and then add the Table widget which can show the results of all of the feature layers with a nice way to select each one.  That would be my recommendation, but again, you need access to Experience Builder.

 

Vakhtang_Zubiashvili
Occasional Contributor II

Thanks Jeffrey, i had no tie to try  your advice, in next few day i will try and let you know my results. 

0 Kudos