A community-supported open source mapping framework built with the Esri JavaScript API and the Dojo Toolkit - https://cmv.io/
@yogeshsharma505 You can easily move the widgets to the right side of the page. Here's a copy of the demo site's viewer.js with a pane on the right side holding all the widgets.
The only changes are configuring a right pane while hiding the default left pane in panes section and then configuring each widget to be in the right
pane.
Hi!
I’m trying to use cmv's find.js to query related records. I wonder if you can give me some advices?
Basically, I’ve a rest MapServer serving a Feature Layer related to a Table Layer.
What I need to do is to find a feature in the Table Layer, return some fields into the grid columns and zoom to the correspondent element in the Feature Layer.
{
description: 'test',
url: 'http://myserver/arcgis/rest/services/test/MapServer/',
layerIds: [4],
relatedTableId: 14,
searchFields: ["relationships/0/serie"],
minChars: 2,
gridColumns: [
{ field: 'snno', label: 'snno', width: 100, sortable: false, resizable: false },
{ field: 'u_mcons', label: 'u_mcons' },
{ field: 'serie', label: 'Nr serie' }
],
sort: [
{
attribute: 'u_mcons',
descending: false
}
],
prompt: 'p.e. "123456"',
selectionMode: 'single'
}
Thanks in advance.
find
operation of a Map Service. I am fairly certain that does not support related records.
preload
in the config effectively, the widget does not actually load until you want to show it. For example, by default a widget is not loaded until the TitlePane (or ContainerPane) that contains the widget is opened.
preload
since it is set to false
by default. The identify widget is the only TitlePane widget in the demo that preloads before its TitlePane is opened.
@tmcgee yes, Find operation does not support related records...
I didn't know how to use your Search widget inside my cmv, so I start to work in other way: query my SQL Server stand alone table and zoom the result using an auxiliar field with x,y coordinates. But now I know that it also doesn't support stand alone tables...
Maybe using your Search widget inside the search tab (is what I want instead of using Attributes Tables) is more easy to implement.
Is there anyone with the similar issue?
Thanks!
@TOldemeyer_gitlab You can create a new custom widget using this one as a starting point. It has the basics for querying a sublayer - in this case, to get metadata. (You can simplify the code greatly since that example does more than you need). You would do a similar query to get the complete extent for all features in the layer. A query that ends up something like this:
which returns this:
{
"extent": {
"xmin": -122.51129560300001,
"ymin": 33.75,
"xmax": -108.60000000000002,
"ymax": 38.100000000000023,
"spatialReference": {
"wkid": 4326,
"latestWkid": 4326
}
}
}
As part of your query, you'll want to reproject the coordinates into the spatial reference used by your map (usually Web Mercator, WKID 102100).
Here's a code snippet for adding the menu for the sublayers.
Hoping this is enough to get you going.
SublayerZoomTo:{
include: true,
type: 'invisible',
id: 'SublayerZoomTo',
path: 'dijit/_WidgetBase',
options: {
map: true,
startup: function() {
topic.subscribe('layerControl/SublayerZoomTo', lang.hitch(this, '_fetchExtent'));
},
_fetchExtent: function (event) {
var url = event.layer.url + '/' + event.subLayer.id + '/query?where=1%3D1&returnExtentOnly=true&outSR=' + this.map.spatialReference.wkid + '&f=json';
new Request({
url: url,
content: {
f: 'json',
}
})
.then(lang.hitch(this, function (result) {
if (result && result.extent) {
var extent = new Extent(result.extent);
this.map.setExtent(extent, true);
}
}))
.otherwise(lang.hitch(this, function (error) {
topic.publish('viewer/handleError', {
source: '_WidgetBase.SublayerZoomTo',
error: error
});
}));
},
_handleError: function(e) {
this._fetchExtent({
id: e,
name: 'Error',
description: 'The query could not execute.'
});
}
},
},
subLayerMenu: {
dynamic: [{
topic: 'SublayerZoomTo',
iconClass: 'fas fa-fw fa-search',
label: 'Zoom to Layer'
}]
},
Hi everyone, I need some help to get a previous value in expression into search widget to automatically updates the next expression, for example in the search configuration:
```
searchFields: [
{
field: 'STATE,
label: 'STATE',
expression: '(STATE LIKE \'%[value]%\')', // STORE THIS VALUE
unique: true,
includeBlankValue: true
},
{
field: 'CITY',
label: 'CITY',
where: 'STATE LIKE \'%[value]%\')', // AND PUT THE PREVIOS VALUE HERE
expression: '(CITY LIKE \'[value]%\')', // THIS WOULD BE A DIFFERENT VALUE
unique: true,
includeBlankValue: true
}
],
```
develop
branch, not the master branch. I have consistently used the code in the develop branch for all deployments of CMV for clients since at least 2015 or 2016 without issue. The code for demo app is continuously deployed with each commit to the develop branch. The developers here and elsewhere that I have interacted with on this topic also use the latest code. I hope this helps.
preload: true
. That is a fairly common mistake.
columns
array specifying the desired columns you want displayed. Instead of recreating that array in the configuration for each query (too much json), you can define all the columns in an array as a variable or object property, then clone that array for each query and show/hide columns as appropriate.