AnsweredAssumed Answered

Display Query Task results in Dojo DataGrid

Question asked by satyanarayana_narmala on Jun 22, 2015
Latest reply on Jun 25, 2015 by rscheitlin

Hi ALL,

 

i am trying to implement the same with some drill down functionality. when i zoom to village level the point features should be highlighted, displaying their attributes in a table as in this example.

 

i am getting the values from the layers but not filling in the table. -------- console.log(values3);

 

where am i going wrong, here is the code

 

 

 

//Populate the dropdown list box with unique values

        var FID;

        var values3 = [];

        var item123 = [];

        var testVals3={};

        //Add option to display all zoning types to the dropdown list 

        values3.push({name:""})          

      

        var features3 = results3.features;

        dojo.forEach (features3, function(feature3) {

       

          FID = feature3.attributes.FID;

          if (!testVals3[FID]) {

            testVals3[FID] = true;

           

            //values3.push({name:ben_id,shape:feature3.geometry,centroid: feature3.geometry.type === "point" ? feature3.geometry : feature3.geometry.getCentroid()}); // RIYAS: set shape to list store

       

            values3.push(feature3.attributes);

           

            /*values3.push({"ben_id":ben_id,

            "ben_name": feature3.attributes.ben_name,

            "dname": feature3.attributes.dname,

            "father_nam": feature3.attributes.father_nam,

            "mname": feature3.attributes.mname,

            "scheme_nam": feature3.attributes.scheme_nam,

            "uid": feature3.attributes.uid,

            "vname": feature3.attributes.vname,

           

           

           

            */

           

           

          }

        });

        

        

        var dataItems3 = {

               identifier: 'FID',

               label: 'FID',

               items: item123

        };

       

        console.log(values3);

       

        var store3 = new ItemFileReadStore({data:dataItems3});

       

          var grid = registry.byId("grid");

          grid.setStore(store3);

         

          grid.on("rowclick", onRowClickHandler);

      

      

       map.centerAndZoom(center, zoom);

        //remove all graphics on the maps graphics layer

        //map.graphics.clear();

 

 

        //Performance enhancer - assign featureSet array to a single variable.

       var resultFeatures3 = results3.features;

      

        //Loop through each feature returned

       for (var i = 0, il = resultFeatures3.length; i < il; i++) {

                //Get the current feature from the featureSet.

                //Feature is a graphic

              var graphic3 = resultFeatures3[i];

              graphic3.setSymbol(symbol1);

 

 

                //Set the infoTemplate.

         graphic3.setInfoTemplate(infoTemplate3);

 

 

                //Add graphic to the map graphics layer.

              map.graphics.add(graphic3);

 

 

                // This takes the graphics array you get back from your query and

                // gets the overall extent for them. Make sure return geometry is set to 

                // true in your query.

              var extent2 = esri.graphicsExtent(results3.features);

 

 

                // Use that to set the extent, 1.5 is something I use in my app, but play with

                // it to find a setting you like, setting the second parameter to true will get you an extend

                // that is at the closest level of your cached service.

               map.setExtent(extent2.expand(1.0), true);

      

           }

      }

       

         function onRowClickHandler(evt) {

          var clickedTaxLotId = evt.grid.getItem(evt.rowIndex).FID;

          var selectedTaxLot = arrayUtils.filter(map.graphics.graphics, function (graphic) {

            return ((graphic.attributes) && graphic.attributes.FID === clickedTaxLotId);

          });

          if ( selectedTaxLot.length ) {

            map.setExtent(selectedTaxLot[0].geometry.getExtent(), true);

          }

        }

 

 

Thanks,

satya

Outcomes