AnsweredAssumed Answered

QueryTask DataGrid and Table

Question asked by abel.ludba on Mar 30, 2015
Latest reply on Mar 30, 2015 by kenbuja


I am new to ArcGIS JavaScript.

I'm using ArcGIS 10 and would like to publish results of a simple Query in a table.

This is my Code:

<!DOCTYPE html>  
    <meta charset="utf-8">  
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">  
    <title>Test QueryTask with Table</title>  
    <link rel="stylesheet" href="">  
    <link rel="stylesheet" href="">  
      html, body { height: 100%; width: 100%; margin: 0; padding: 0; }  
    <script src=""></script>  
   var queryTaskTwo, queryTWO;  
        var grid, store;  
   function (parser, Query, QueryTask, registry, arrayUtils, dom, on, DataGrid, ItemFileReadStore) {  
      queryTaskTwo=new QueryTask("")  
   queryTWO=new Query();  
        on(dom.byId("execute"), "click", execute);  
        function execute ()   
   queryTWO.text = dom.byId("stateName").value;  
          queryTaskTwo.execute(queryTWO,showResultsTwo );   
  function showResultsTwo(resultsTwo) {   
          //create array of attributes  
          var items =, function (result)   
            return result.feature.attributes;  
          //Create data object to be used in store  
          var data = {  
            identifier : "SQMI", //This field needs to have unique values  
            label : "SQMI", //Name field for display. Not pertinent to a grid but may be used elsewhere.  
            items : items  
          //Create data store and bind to grid.  
          store = new ItemFileReadStore({  
            data : data  
          var grid = dom.byId("grid");   
     grid.setQuery({ SQMI: "*" });  
        // .................................................  
  <body class="tundra">  
    US state name :  
    <input type="text" id="stateName" value="California">  
    <input id="execute" type="button" value="Get Details">  
    <br />  
    <br />  
   <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'bottom'" style="height:150px;">  
     <table data-dojo-type="dojox/grid/DataGrid" data-dojo-id="grid"  id="grid" data-dojo-props="rowsPerPage:'5', rowSelector:'20px'">  
          <th field="SQMI"  width="10%">SQMI</th>  
          <th field="STATE_NAME" width="10%" >STATE_NAME1</th>  
          <th field="POP00_SQMI" width="30%" >SUB_REGION2</th>  
          <th field="HOUSEHOLDS" width="20%">AVG_SIZE97</th>  
          <th field="BLACK" width="10%">BLACK </th>  
          <th field="MALES" width="20%">OWNER_OCC</th>  


when I run this code, I get this error:

TypeError: undefined is not a function {stack: (...), message: "undefined is not a function"} "TypeError: undefined is not a function     at showResultsTwo (http://localhost/Dgrid/queryMultipleTest2.html:74:16

I could not find what am I doing wrong?

Would it be possible to help?