Query results not displaying in dojo grid

1077
3
Jump to solution
09-16-2013 08:51 AM
KennethRichards
New Contributor III
My query that I am running returns good results in my console but will not display in my dojo grid. My function that populates the grid performs some extra work by pulling multiple hyperlinks out of one field and separating into different columns in the grid based on the extensions.

Can anyone see why my function doesn't populate my grid? I can post more code if anyone needs.

require(["dojo/store/Memory","dojox/grid/DataGrid", "dojo/ready", * * "esri/tasks/query","esri/tasks/QueryTask", * * "dojo/dom","dojo/on","dojo/_base/array","dojo/domReady!"], function(Memory,DataGrid,ready,Query,QueryTask,dom,on,array){     ready(function(){     var myQueryTask, myQuery;     myQueryTask = new QueryTask("http://.../ArcGIS/rest/services/aasggeothermal/AZWellHeaders/MapServer/0");      myQuery = new Query();     myQuery.returnGeometry = false;     myQuery.outFields = ["*"]; function runQuery(){     var apiNo = dom.byId('apinum').value;     var otherId = dom.byId('stateperm');     myQuery.where ="apino like '%" + apiNo + "%'" + " OR " + "otherid like '%" + otherId + "%'";  myQueryTask.execute(myQuery,updateGrid);  }  function updateGrid(featureSet){         var data=[];         var grid = dom.byId('grid');         array.forEach(featureSet.features, function (entry) {             var logs = [],                 las = [],                 folders = [],                 relatedResource = entry.attributes.relatedresource === null ? "no value" : entry.attributes.relatedresource;             var raw = relatedResource.split("|");             raw.forEach(function (bit){                 var resource = bit.split(", ");                 if (resource[0] && resource[1]){                 var url = resource[1].trim();                 var name = resource[0].trim();                 }                 var anchor = "<li><a href='" + url + "' target='_blank'>" + name + "</a></li>";                 if (url != null ){                 if ( url.indexOf(".tif", url.length -4) !==-1){                     logs.push(anchor);                 }                 if ( url.indexOf(".pdf", url.length -4) !==-1){                     folders.push(anchor);                 }                 if ( url.indexOf(".las", url.length -4) !==-1){                     las.push(anchor);                 }                }             });             data.push({                 objectid:entry.attributes.objectid,//0                 apino:entry.attributes.apino,//1                 otherid:entry.attributes.otherid,//2                 wellname:entry.attributes.wellname,//3                 county:entry.attributes.county,//4                 twp:entry.attributes.twp,//5                 rge:entry.attributes.rge,//6                 section_:entry.attributes.section_,//8                 drillertotaldepth:entry.attributes.drillertotaldepth,//9                 formationtd:entry.attributes.formationtd,//10                 logField: '<ul>' + logs.join(" ") + '</ul>',                 lasField: '<ul>' + las.join(" ") + '</ul>',                 folderField: '<ul>' + folders.join(" ") + '</ul>'             });         });         var dataForGrid= {             items: data             }; console.log(data);         var store = new Memory({data:dataForGrid});         grid.setStore(store);     }


[HTML]
<div id="outGrid"
    data-dojo-type="dijit.layout.ContentPane"
    data-dojo-props="region:'bottom'">
    <table data-dojo-type="dojox.grid.DataGrid" escapeHTMLInData="false" jsid="grid" id="grid" data-dojo-props="rowsPerPage:'5', rowSelector:'20px'" style="height:100%; width:100%">
        <thead>
        <tr>
            <th field="apino" width="auto">API No</th>
            <th field="otherid" width="auto">State Permit No</th>
            <th field="wellname" width="auto">Operator</th>
            <th field="county" width="auto">County</th>
            <th field="twp" width="auto">Township</th>
            <th field="rge" width="auto">Range</th>
            <th field="section_" width="auto">Section</th>
            <th field="drillertotaldepth" width="auto">Depth (ft)</th>
            <th field="formationtd" width="auto">Formation at Depth</th>
            <th field="folderField" width="auto" >Well Folder</th>
            <th field="logField" width="auto" >Scanned Well Log</th>
            <th field="lasField" width="auto" >LAS Data</th>
        </tr>
        </thead>
    </table>
</div>
[/HTML]

I'm just learning to use version 3.6 and AMD. I am more familiar with 3.5 and Legacy.
0 Kudos
1 Solution

Accepted Solutions
JasonZou
Occasional Contributor III
Try to add one more dependency and make one more change.


  • Dependency: "dojo/data/ObjectStore"

  •     Alias: ObjectStore

  • Change:
    var store = new Memory({data:dataForGrid});


  •     To:
    var store = new ObjectStore({ objectStore: new Memory({ data: dataForGrid }) });

View solution in original post

0 Kudos
3 Replies
JasonZou
Occasional Contributor III
Do two things:

1. Add "dijit/registry" to the dependency list, and use registry as the alias.
2. Change: 
var grid = dom.byId('grid');

    To: 
var grid = registry.byId('grid');
0 Kudos
KennethRichards
New Contributor III
Do two things:

1. Add "dijit/registry" to the dependency list, and use registry as the alias.
2. Change: 
var grid = dom.byId('grid');

    To: 
var grid = registry.byId('grid');


I made those changes and it is still not showing up in my grid. Any other idea?
0 Kudos
JasonZou
Occasional Contributor III
Try to add one more dependency and make one more change.


  • Dependency: "dojo/data/ObjectStore"

  •     Alias: ObjectStore

  • Change:
    var store = new Memory({data:dataForGrid});


  •     To:
    var store = new ObjectStore({ objectStore: new Memory({ data: dataForGrid }) });

0 Kudos