ryansmith52

Use of variable outside queryFeatures function

Discussion created by ryansmith52 on Apr 23, 2014
Latest reply on Apr 25, 2014 by schlot
Hi
I have the following code to query different feature layers. I would like to know if it's possible to use the searchItems variable outsidethe actual queryFeatures anonymous function because i need to get all the results from the different layers and then attach it to one datagrid.

Thanks 


        layers[layerId].LayerVariable.queryFeatures(query, function (featureSet) {
            resultFeatures = featureSet.features;
                           

                     var items = dojo.map(featureSet.features, function (feature) {
                        return feature.attributes;
                     });

                    
                         var data = {
                             identifier: "OBJECTID",
                             items: items
                         };

                         node = dojo.byId("searchHeader");

                         var store = new dojo.data.ItemFileReadStore({
                             data: data
                         });


                         grid = new dojox.grid.DataGrid({
                             store: store,
                             structure: structure
                         });


                         node.appendChild(grid.domNode);

                         grid.startup();
                     }
                }    
     
        });

Outcomes