var data = arrayUtils.map(featureSet.features, function (entry, i) { return { NAME: entry.attributes.SITENAME, REGION: entry.attributes.REGION, WATERBODY: entry.attributes.WATERBODY, TYPE: entry.attributes.TYPE, ACCESSAREA: entry.attributes.ACCESSAREA, LOCATION: entry.attributes.LOCATION }; }); grid.store.setData(data); grid.refresh();
var newStore = new dojo.data.ItemFileReadStore({data: { identifier: "", items: []}}); var grid = dijit.byId("grid"); grid.setStore(newStore); }
Solved! Go to Solution.
var data = array.map(results.features, function(feature) { return { "id": feature.attributes[outFields[0]], "NAME": feature.attributes[outFields[2]], "WATERBODY": feature.attributes[outFields[3]], "ACCESSAREA": feature.attributes[outFields[5]], "LOCATION": feature.attributes[outFields[9]] } });
outFields = ["OBJECTID", "SITENAME", "WATERBODY", "ACCESSAREA", "LOCATION"];
var data = array.map(results.features, function(feature) { return { "id": feature.attributes[outFields[0]], "SITENAME": feature.attributes[outFields[1]], "WATERBODY": feature.attributes[outFields[2]], "ACCESSAREA": feature.attributes[outFields[3]], "LOCATION": feature.attributes[outFields[4]] } });
var data = array.map(results.features, function(feature) { return { "id": feature.attributes["OBJECTID"], "SITENAME": feature.attributes["SITENAME"], "WATERBODY": feature.attributes["WATERBODY"], "ACCESSAREA": feature.attributes["ACCESSAREA"], "LOCATION": feature.attributes["LOCATION"] } });
gridNoColumnSets.set("columnSets", columnExample2);
Title Image Address some other info
Image Title Address some other info
Version 3.9 of the ArcGIS API for JavaScript uses Dojo 1.9.1 as well as version 0.3.11 of dgrid, 0.3.5 of put-selector and 0.1.3 of xstyle.
<link rel="stylesheet" href="http://js.arcgis.com/3.9/js/dgrid/css/dgrid.css">
Dgrid is also included in the ESRI JSAPI; no additional installation required.Let me know if you have any additional questions about dgrid!
Field 3 Field1 Field 2 Field 4 Field 5 Field 6
var columnExample2 = [ {"label": "id", "field": "ACCESSAREA" }, { "label": "County", "field": "COUNTY", "rowspan": "2" }, { "label": "Access", "field": "ACCESSAREA" }, { "label": "Waterbody", "field": "WATERBODY", "formatter": function (value) { return "<strong>" + value + "</strong>"; }, "get": function (object) { return object["WATERBODY"]; } }, { "label": "Type", "field": "TYPE", "sortable": false }, { "label": "Location", "field": "LOCATION", "hidden": true } ];
<table id="gridFromHtml" class="grid"> <colgroup span="2"></colgroup> <colgroup span="2"></colgroup> <thead> <tr> <th data-dgrid-column="{field:'col1'}">Column 1</th> <th data-dgrid-column="{field:'col2', sortable:false}">Column 2</th> <th rowspan="2" data-dgrid-column="{field:'col1'}">Column 1</th> <th data-dgrid-column="{field:'col4'}">Column 4</th> </tr> <tr> <th colspan="2" data-dgrid-column="{field:'col3'}">Column 3</th> <th data-dgrid-column="{field:'col5'}">Column 5</th> </tr> </thead> </table>