Skip to content

Commit

Permalink
Merge pull request #266 from barryytm/2.0.1-2364
Browse files Browse the repository at this point in the history
Use mapName from service as name for a legend entry if not provided
  • Loading branch information
james-rae authored Sep 12, 2017
2 parents 432174c + 6b462d9 commit 81fcc57
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "geoApi",
"version": "v2.0.1-5",
"version": "v2.0.1-6",
"description": "",
"main": "src/index.js",
"dependencies": {
Expand Down
15 changes: 14 additions & 1 deletion src/layer/layerRec/dynamicRecord.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,19 @@ class DynamicRecord extends attribRecord.AttribRecord {
this._layer.setVisibleLayers([-1]);
}

// get mapName of the legend entry from the service to use as the name if not provided in config
if (!this.name) {
const defService = this._esriRequest({
url: this._layer.url + '?f=json',
callbackParamName: 'callback',
handleAs: 'json',
});
const setTitle = defService.then(serviceResult => {
this.name = serviceResult.mapName;
});
loadPromises.push(setTitle);
}

Promise.all(loadPromises).then(() => {
this._stateChange(shared.states.LOADED);
});
Expand Down Expand Up @@ -494,7 +507,7 @@ class DynamicRecord extends attribRecord.AttribRecord {

/**
* Retrieves attributes from a layer for a specified feature index
*
*
* @function getFormattedAttributes
* @param {String} childIndex index of the child layer to get attributes for
* @return {Promise} promise resolving with formatted attributes to be consumed by the datagrid and esri feature identify
Expand Down

0 comments on commit 81fcc57

Please sign in to comment.