-
-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
problem with formatter in identify #675
Comments
@shshwang formatters were not available in version 1.3.4. Documentation for that release is here. You can download the current 2.0 beta version in development that includes formatters and dozens (or more! 😄) of additional enhancements here. The updated documentation (a work in progress) for this latest release can be found here. |
@tmcgee Thank you so much for your quick reply! I actually played with the newer release too. Didn't get it to work yet. The popup window used the default field values instead of those specified in identify.js. }, {
type: 'dynamic',
url: 'http://mycity.houstontx.gov/cohgis/rest/services/PD/Cadastral_wm/MapServer',
title: i18n.viewer.operationalLayers.cadastral,
options: {
id: 'cadastral',
opacity: 1.0,
visible: true,
outFields: ['*'],
imageParameters: buildImageParameters({
layerIds: [0],
layerOption: 'show'
}),
mode: 0
},
visibleLayerInfos: {
layerIds: [-1] // Do not show any layers in default
},
identifyLayerInfos: {
layerIds: [0]//
}
} in identify.js cadastral: {
0: {
title: i18n.identify.cadastral.parcels,
fieldInfos: [{
fieldName: 'County',
label: 'County',
visible: true
}, {
fieldName: 'Tax ID',
label: 'Tax ID',
visible: true,
formatter: function (value, attributes) {
alert('value='+value);
var FBLink = "http://fbcad.org/Property-Search-Results?searchtext=";
var MLink = "http://mcad-tx.org/Property-Search-Result?searchtext=";
var HLink = "http://www.hcad.org/records/outsider/hc.asp?acct="+value;
alert(HLink);
if (value.includes("R")){
MLink += value;
return '<a href="' + MLink + '"target="_blank">{Tax ID}</a>';
}
else if (value.includes("-")) {
FBLink += value.replace("-", "");
return '<a href="' + FBLink + '"target="_blank">{Tax ID}</a>';
}
else {
HLink += value;
return '<a href="' + HLink + '"target="_blank">{Tax ID}</a>';
}
}
}]
}
}, I also updated main.js for corresponding title values. There is no error message either. Do you have any ideas? |
@shshwang there may be a new bug here when retrieving the info template for sublayer id = 0. I will investigate further. |
Thank you! |
There's definitely a bug with the Identify on layer 0 for dynamic layers. It happens here: //....
getInfoTemplate: function (layer, layerId, result) {
var popup, config;
if (result) {
layerId = result.layerId || layer.layerId; //<---- if result.layerId is 0, layerId becomes undefined
} else if (layerId === null) {
layerId = layer.layerId;
} |
Introduced here: 04fd307 |
I was following the cmv doc to add url links for one identify field. But it seems the formater function was not executed. The alert doesn't even show up. The popup window still shows the label and field value but no link. Any idea why it is so? I downloaded cmv 1.3.4 a year ago. Is it possible that I might miss some functions or module in order to use formater? Thank you so much for your help!
Cadastral: {
0: {
title: 'Parcel Information',
fieldInfos: [{
The text was updated successfully, but these errors were encountered: