Select to view content in your preferred language

view multiple pictures

5155
42
03-17-2011 06:03 AM
RandellMcGlynn
Emerging Contributor
Hi, I'm trying to create a web app with the flex viewer, but I need to show multiple pictures for one point. I've used the enhanced identify widget, to show one picture, but is there a way to view more than one (For this project, I only need to show 2 images, but it would be nice to show more than 2). I don't have to use the identify widget, I would just prefer it, but if there is no other way I would be alright with that.

Thanks in advance.
Tags (2)
0 Kudos
42 Replies
RobertScheitlin__GISP
MVP Emeritus
Rhett,

   Find this line in the AttRelateInfoWinWidget.mxml

if (multiImgField && fields == multiImgField)


and change it to

if (multiImgField && fields == multiImgField && attrvalue != null)
0 Kudos
RhettZufelt
MVP Notable Contributor
Excellent.  Works like a charm.

Thanks again Robert for your help,

Rhett
0 Kudos
RhettZufelt
MVP Notable Contributor
Well, that worked for the missing image issues, but have noticed that I get a similar issue when switching services.

In other words, I have several layers loading as type="feature", which requires the sub layer number on the end of the url.

I have config.xml's set up for several of these with the InfoTemplates (with multiimage enabled).  Some feature layers are being loaded from a single service (http://server/ArcGIS/rest/services/Base/MRs/MapServer/0) and another to .../1.  While others come from a different service (with or without sub layers, doesn't seem to matter).

As long as I click on any of the features from a single service (doesn't matter with sub layer as long as it is from the same base service), the popup works correctly with the title field.

However, if I have clicked on one of the service layers, then click on a feature from a DIFFERENT service, the title is blank.  re-click on the same feature, and it gets populated.
I have put the same field I'm using for titlefield in the fields list, and is displayed correctly, so I know it is loading the correct data, but for some reason, the map.infowindow.label = title; does not seem to get updated until I click on it twice.

In fact, if I change that snippet in your AttRelateinfoWinWidget.mxml to map.infowindow.label = "Title text"; then EVERY time I click it will put the hard coded "Title text" up there.   Almost if it is skipping the part that set the title variable on layer change until clicked a second time.

Anyway, pretty much exausted myself trying to figure this out, so thought I'd see if you have any ideas on how to approach this.

Thanks,

R_
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Rhett,

   You can try move it right under this line and see if that helps:

var title:String = data[titleField];



So it would look like this:

var title:String = data[titleField];
map.infoWindow.label = title;
0 Kudos
RhettZufelt
MVP Notable Contributor
Already tried that, but didn't work.

Thought maybe it was related to the warning about "Duplicate Variable definition", but if I hard code that, it still takes it.

I.e.,     If I modify it to this:

var title:String = "Testing";
map.infoWindow.label = title;.


Then it picks it up every time and always says "Testing" for my label no matter how much switching between services I do.

So, I then did this:

var title:String = titleField;
map.infoWindow.label = title;



So, it should now put the <titlefiled> field name up there instead of the value.  From this, I can tell that it is using the <titlefield> from the last config file the first time you click on a feature using a different config file.

Example,
I have a waste site point layer <titlefield> = "sitecode"
I have a waste site line layer <titlefield> = "sitecode"
I have a building layer <titlefield>="name"

with the modification I mentioned above, if I click on a wastesite point feature, the popup label is "sitecode", if I then click a building feature, the popup label says "sitecode" (wrong), if I click it a second time, it will now say "name" (right).  Then, click on any waste site, and the label is "name"(wrong),  click again and it says "sitecode"(right).

Of course, I can click between the wastsite lines and points and it works as both have the "SITECODE" field.  So, it seems to be pulling the <titlefield> from the last layer config file, BUT is extracting the data for that field from the correct (current) layer.

So, the reason it was not "mis behaving" when I cliked on different sub-layers is that both of them have a "sitecode" field so it could extract the value.  It is when it tries to get data from a field that doesn't exist (because it is using the <titlefield> from a differnent layer, and that field does not exist in this data set (buildings does not have a "sitecode" field)) that it returns a blank.

Any ideas on how to make it read the titlefield from the correct config file (instead of from memory or wherever it gets it) the "first" time I click a feature?

Thanks again,

Rhett

Little more on this.  Just noticed that I can click on many features in a layer and it keeps working.  The first time I click a feature from a different layer  it works correctly also.  Any more clicks after that is when it starts misbehaving as above and keeps misbehaving until I do a reload of the page <cntr> <F5>.  So, it lets me switch between layers once only.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Rhett,

   I can see the issue, but am still working on how to fix it.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Rhett,

   Latest version fixes the issue:

Version 2.5.0.1 Dec 16, 2011
* Fixed issue with using MultiImage and MultiImage field containing null left old title on the infowindow.
* Fixed issue with title on info window not always changing when you choose a different layer until the second click.
0 Kudos
RhettZufelt
MVP Notable Contributor
Hi Robert,

I have downloaded your latest source code and replaced all the contents in my InfoTemplates folder (other than the config files).  then, re-built project, and even did a clean.

However, I am still getting the missing title on second click (once layer switched).

To simplify, I stripped all the layers from my map except two, loaded as type=feature coming from two separate services, and with different attribute item names.

I can click on as many features in one layer as I want, and it works fine.  Then, I can click on as many features from the "second" layer as I want and it works fine.  HOWEVER, when I switch layers a second time, it goes right back into the "have to click twice" to get the label issue.  From this point on, every time I click on a feature from the "other" layer (other meaning other than the one I just clicked), it will not show the title unless I click the feature a second time.

Once I do click on that layers item a second time, it will keep working correctly as long as I keep clicking that layer only.  Loses it again on switch.

If I do a refresh, it starts over letting me switch between layers ONCE.

Work around for now is to not have a title block, and put the titlefield as the first <fields> item.  However, sure like the bold title up there (when it works).

Thanks agian for the help,

Rhett
0 Kudos
RhettZufelt
MVP Notable Contributor
Rhett,

   For the thumbnail to appear instead of the picture icon you have to have a link with these image file extensions:

if ((sfx == ".jpg") || (sfx == ".png") || (sfx == ".gif"))
If you have a url that produces and image through a url query or something than it will appear as an icon instead.


This is working fine for my .jpg images, but I am now using it to pull pdf's as well.  It will launch them just fine, however, the picture icon is a broken link.
Was wondering what/where the image is that is used for the picture icon as I seem to be missing it. (can't seem to find where it is referenced in the code).

Thanks again,

R_

I am using v3.0 final
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Rhett,

   This thread has gone all over the place, so remind me what we are talking about again... Are you saying that you are adding links to the Attachment Relate Info Window widget that point to pdfs and the icon is not showing when you have these attributes in the linkfield tag?

icon_or_text_or_img="icon" icon="assets/images/i_lego.png" 
0 Kudos