AnsweredAssumed Answered

Very Simple Populate dgrid

Question asked by PW941248 on Apr 7, 2014
Latest reply on Apr 7, 2014 by JUihlein-esristaff
Hi folks:

I'm trying to use a query task to populate a dgrid... That's it; I don't want it to do anything else. I just want the data to be there in table form. I may and possibly will expand functionality in the future, but for now I just want to data to display. I know there are a lot of samples out there of this, but many of them have a lot of added functionality, and some use older versions of the API and some others are using dataGrid which is apparently the old version of dgrid. I'm just having trouble weeding through the samples to get to the basic functionality I want and I'm getting frustrated.

I'm a very new programmer and was hoping someone could provide a fiddle of how to do this very basic task.

Here is my relevant code:

 var tableVal = response.features[i].attributes.SOC2010Code;
            var tableQuery = new Query();
            tableQuery.where = "SOC_Code = " + tableVal;
            tableQuery.returnGeometry = false;
            tableQuery.outFields = ["SOC_Code", "Title", "Employment", "Average_Annual_Openings"];
            var tableQueryTask = new QueryTask("http://w7hp348/arcgis/rest/services/Testservice/XTest/MapServer/2"+ "?returnDistinctValues=true");

Queries the table in the map service

and then the call back:

        function populateTable(SOC)
          var data = [];
          data = (SOC.features, function(feature)
              'SOC_Code': feature.attributes.SOC_Code};
            //rest of relevant output here
          grid = new dgrid.Grid(
              showHeader: false
            }, "grid");

As you can see I'm in the middle of figuring out exactly how to code this. I know the call back and query are executing exactly how I want them to, it is really just a matter of getting that data into a grid.

Any help would be greatly appreciated. These forums are a wonderful resource.