Select to view content in your preferred language

Can we Load Versioned Feature layer passing version name in URL Params

277
1
Jump to solution
06-06-2022 10:07 AM
naveenbesri
Occasional Contributor

Hi,

As per our current requirement we need to load branch version data in web app where we will pass version name in the url params. could anybody please give some idea how to achieve this using javascript api.

 

Thanks,

Naveen

0 Kudos
1 Solution

Accepted Solutions
JoelBennett
MVP Regular Contributor

The MapImageLayer class has a gdbVersion property that allows you to specify the version for the layer (FeatureLayer does too).  Therefore, you would get the version name from the URL, and add it into the constructor for the layer.  For example (assuming the name of the version parameter in your URL is "version"):

var myLayer = new MapImageLayer({
	url: "https://myserver/arcgis/rest/services/MyService/MapServer",
	gdbVersion: new URLSearchParams(window.location.search).get("version")
});

 

 

View solution in original post

1 Reply
JoelBennett
MVP Regular Contributor

The MapImageLayer class has a gdbVersion property that allows you to specify the version for the layer (FeatureLayer does too).  Therefore, you would get the version name from the URL, and add it into the constructor for the layer.  For example (assuming the name of the version parameter in your URL is "version"):

var myLayer = new MapImageLayer({
	url: "https://myserver/arcgis/rest/services/MyService/MapServer",
	gdbVersion: new URLSearchParams(window.location.search).get("version")
});