Select to view content in your preferred language

Return graphics from mulitiple layers

26
0
yesterday
Mr_Kirkwood
Occasional Contributor

I have an onclick function, but it is tied to one layer. How can i make it so that i can use multiple layers? 

 

view.on ("click", function (event)
            {
                // Handle feature selection here
                console.log ("Get Selected Features Data")
                $ ('#customWindow').jqxWindow ('close');
                 $ ('#assignedEmployeesTable').jqxGrid ('clear')        
                view.hitTest (event).then (function (response)
                {
                    if (response.results.length > 0) {
                        const features = response.results.filter (function (result)
                        {
                            return result.graphic.layer === roomsUseLayer;// Filter for your specific layer
                        });

                        // Extract attributes from the selected features
                        features.forEach (function (feature)
                        {
                            attributes = feature.graphic.attributes;
                            console.log (attributes.SPACEID);
                            
                        });
                        getSpaceObjectID ();
                    }
                });
            });

 

Thanks for your help. 

0 Kudos
0 Replies