GodSpeed JP1
Posts: 0
Joined: Thu Feb 27, 2014 1:23 pm

How to change image in list according to list data?

I hava a list which hava a image and a number data on it.
When the number 10, I want show image A on the list,
and when the number < =10 , I want show image B on it.
so list would like:
A(image) 11
A(image) 22
B(image) -11
I try to write some js code when the service set the number to the list element at data mapping page[ADD JS].
I wrote:
function(value, element) {
if (value 10) {
element.parent().find($('image-componet-name')).attr("src", Appery.getImagePath("A.png"));
}else {
element.parent().find($('image-componet-name')).attr("src", Appery.getImagePath("B.png"));
}

But it not work,
I think the "element.parent().find($('image-componet-name'))" is not right,
I want to know how to set a element according to another 's value in a list.
Anyone can help me?

Nikita
Posts: 0
Joined: Fri Feb 28, 2014 4:02 pm

How to change image in list according to list data?

Hello,

$('image-componet-name') -- this is the wrong approach.
You should use this:

$('[name=image-componet-name]')

GodSpeed JP1
Posts: 0
Joined: Thu Feb 27, 2014 1:23 pm

How to change image in list according to list data?

Hello Nikita, it works.Thank you very much.

Vikram Raju
Posts: 0
Joined: Mon Jul 20, 2015 4:06 am

How to change image in list according to list data?

how to pass element?

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

How to change image in list according to list data?

Hello,

Could you please specify your question?

Vikram Raju
Posts: 0
Joined: Mon Jul 20, 2015 4:06 am

How to change image in list according to list data?

it is not working for me thatS what i tried to say.....

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

How to change image in list according to list data?

Please show us what you have tried.

Vikram Raju
Posts: 0
Joined: Mon Jul 20, 2015 4:06 am

How to change image in list according to list data?

Thats how I implemented the code

Return to “Issues”