If you are unable to create a new account, please email support@bspsoftware.com

 

solved: ArcGIS api for javascript (mapping) used in Custom Control code

Started by randomcoder, 03 Dec 2017 09:15:20 AM

Previous topic - Next topic

randomcoder

Hi all!

Has anyone successfully used ArcGIS API for Javascript in Custom Control?
I have some stuff in ArcGIS online that I would like to integrate into reports.

I have very little experience with javacript and this RequireJS and AMD stuff is all new to me so I started experimenting with tutorials provided by ArcGIS.
I think I managed to convert code from an ArcGIS tutorial sample into Custom Control api.

Sample is at
https://developers.arcgis.com/labs/javascript/create-a-2d-map-with-a-layer/
Finished sample is available at
https://jsbin.com/takemum/edit?html,output).

When I use the Custom Control in dummyreport (contains only the custom control
widget), basemap is ok but features seem to be aligned all wrong. Actually no
features are shown on the basemap but some can be seen below the basemap (I
set the Custom Control widget height to 500px).

Any ideas what is wrong? I took the code from the sample as is and tried to
make minimal modifications:
- require.config so that arcgis code is downloaded from ArcGIS CDN
- stuff from require into define
- used oControlHost.container as container for MapView

Attached is the original html containing the javascript, my take on custom
control wrapper and pictures about what the map should look like and what it
actually looks like in the report.

EDIT: Figured out what the problem is...
It turns out ArcGIS stylesheet "main.css" is actually important. Without it the original (html) code works in the same wrong way.
One of the cognos custom control samples (can't remember the name, easy to find, just look for *.css) contained an example of loading css in the js.

ricckli

unfortunately the zip is not available anymore. does someone can re share the example?