Page 1 of 1
Problem with images in a grid
Posted: Wed Aug 09, 2017 11:33 am
by mwalter
I'm having an issue with images in a grid. I have a grid that has image thumbnails. What I'd like to do is, when an image is clicked, grab the property image source, and use it to show a window with a full sized image. I'm using the following javascript to get the image source.
var imgSrc = getObj(this).pui.properties("image source");
However, when I execute it, I get the error "Cannot read property "pui" of null". Which is telling me that the object is null.
I've also tried getObj with the object ID. I've double and triple checked my spelling.
Any Ideas?
Re: Problem with images in a grid
Posted: Wed Aug 09, 2017 1:17 pm
by Darpan
Hello,
The following documentation page explains how to retrieve a widget property:
http://www.profoundlogic.com/docs/displ ... t+property
We don't have any specific API to retrieve property of widget but we have special code that can achieve this task.
getObj(id).pui.properties[propertyName];
Can you please try using object Id and use square brackets for property name.
var imgSrc = getObj("Image1").pui.properties["image source"];
This code worked for me. I was able retrieve the value of image source.
Re: Problem with images in a grid
Posted: Wed Aug 09, 2017 1:29 pm
by mwalter
I've tried this. The difference is that the images are in a grid. I have 6 image widgets in a grid row. It's acting like the id's are not there. WHen I try something like alert(getObj("IMGNAME")); on the onClick event, it returns Null.
Re: Problem with images in a grid
Posted: Wed Aug 09, 2017 2:19 pm
by Emily
Hi Mark,
Because your images are in a grid, you will need to append the row number to the ID of the image. So, you'd need to do something like this:
var imgSource = getObj("IMGID." + row).pui.properties["image source"];
I tested this on my end and it seemed to work as expected. Could you give this a try and see if this works for you?
I hope that this helps!
Re: Problem with images in a grid
Posted: Wed Aug 09, 2017 2:25 pm
by mwalter
Awesome Emily. I'll give that a try.
Re: Problem with images in a grid
Posted: Wed Aug 09, 2017 3:19 pm
by mwalter
Works perfectly. Thank you.