ghuisintveld
Posts: 0
Joined: Fri Jun 08, 2012 11:29 am

Selecting an image asset from data mapping

I have a REST service which returns documents, including the file type. Say the type can ben PDF or XML. I would like to display an image icon showing the file type.

I have uploaded two image assets and named one pdf.png and the other xml.png. I have mapped the service property file-format to the image asset and use the following custom javascript:

return "image/" + value + ".png";

Although this seems to be working OK (when I check the source, the src property of the image is changed to image/pdf.png), the image won't display. It looks the image URL starts with http://tiggzi.com/views/.... and the html is in http://tiggzi.com/view/.

What should I do?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Selecting an image asset from data mapping

Take one of the images and add it to the page via Image component. Look at the source for the URL -- that's the link that should be used.

ghuisintveld
Posts: 0
Joined: Fri Jun 08, 2012 11:29 am

Selecting an image asset from data mapping

Hi Max,

I have now made an image sprite and refer to this sprite in my CSS:
background-image : url('http://project.tiggzi.com/views/82615...;

In the data mapping I've added a javascript:

element.addClass("icon32x32").addClass(value);
return "http://project.tiggzi.com/views/82615...;

The use of spacer.gif is a hack to make this work.

This all works fine, except when testing in the android mobile tester (because the URL's aren't relative?).

How can I fix this for the mobile app?

Thanks,

Gerard

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Selecting an image asset from data mapping

Do you mean because in the return you use an absolute URL, it does't work when testing on Tiggzi mobile app tester?

ghuisintveld
Posts: 0
Joined: Fri Jun 08, 2012 11:29 am

Selecting an image asset from data mapping

Exactly. The problem is that relative URL's don't seem to work when testing in the browser...

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Selecting an image asset from data mapping

Doesn't work in the browser or the mobile app tester?

ghuisintveld
Posts: 0
Joined: Fri Jun 08, 2012 11:29 am

Selecting an image asset from data mapping

Absolute URL's don't work in the app tester.
Relative URL's don't work in de browser.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Selecting an image asset from data mapping

In the web browser, what do you get if you enter the image URL in the address bar?

ghuisintveld
Posts: 0
Joined: Fri Jun 08, 2012 11:29 am

Selecting an image asset from data mapping

http://project.tiggzi.com/views/82615... simply seems to work OK.This is the absolute URL used in the css.

The location of the html however is http://project.tiggzi.com/view/82615d... (view, not views). This is why relative URL's don't seem to work I guess...

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Selecting an image asset from data mapping

The Android tester downloads the app to the phone but I don't believe it has access to the project on the web (http://project.tiggzi.com/viewi/xxxx). Just include the actual images in your app. If you need to update the image in runtime, you can do this:

Tiggzi('imageName').attr('src', 'newImage');

Return to “Issues”