AnsweredAssumed Answered

Display attribute table with JavaScript API ver 4.9?

Question asked by psba_ldudina on Oct 21, 2018
Latest reply on Nov 8, 2018 by rscheitlin

How to display feature layer's attribute table with JavaScript API ver 4.9? 

 

I am working with ArcGIS API for Javascript 4.9. I want to create a simple map view and display a table under it. I am stuck trying to work out how to display a table displaying data from a feature layer published on ArcGIS  with this version of API. I removed all code related to the map to make it simpler till I work out this table.

 

Here is my code:

 

 

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tutorial: Grids and Stores</title>

<link rel="stylesheet" href="https://js.arcgis.com/4.9/esri/css/main.css">
</head>
<body class="claro">
<h1>Display table with feature layer and dgrid </h1>
<div id="grid"></div>


<script src="https://js.arcgis.com/4.9/"></script>
<script>
require([

"dojo/_base/declare",
"dstore/RequestMemory",
"dgrid/Grid",
"dgrid/extensions/Pagination"
], function (declare, RequestMemory, Grid, Pagination) {
// Create a Grid instance using Pagination, referencing the store

var gridFields = ["__OBJECTID", "WAL_NAME", "REGION", "WAL_ZONE", "REGION_WAL", // __OBJECTID
"WAL_Value", "SWAL_Value"
];


var grid = new (declare([ Grid, Pagination ]))({
collection: new RequestMemory({ target: "https://xxxxxxxxx/arcgis/rest/services/GCX/QFESAlertLevels_GCX/FeatureServer/1?f=pjson" }),
className: 'dgrid-autoheight',
columns: gridFields,

}, 'grid');

grid.startup();
});
</script>
</body>
</html>

 

The error that I get is:

 

Any ideas? Did anyone get it to work?

 

Thanks!

Outcomes