Page 1 of 2

How to change image in list according to list data?

Posted: Mon Mar 17, 2014 10:55 am
by GodSpeed JP1

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?


How to change image in list according to list data?

Posted: Mon Mar 17, 2014 12:37 pm
by Nikita

Hello,

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

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


How to change image in list according to list data?

Posted: Mon Mar 17, 2014 1:09 pm
by GodSpeed JP1

Hello Nikita, it works.Thank you very much.


How to change image in list according to list data?

Posted: Sat Sep 19, 2015 6:38 am
by Vikram Raju

how to pass element?


How to change image in list according to list data?

Posted: Sat Sep 19, 2015 7:06 am
by Alena Prykhodko

Hello,

Could you please specify your question?


How to change image in list according to list data?

Posted: Sat Sep 19, 2015 9:43 am
by Vikram Raju

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


How to change image in list according to list data?

Posted: Sat Sep 19, 2015 1:57 pm
by Alena Prykhodko

Please show us what you have tried.


How to change image in list according to list data?

Posted: Mon Sep 21, 2015 4:34 am
by Vikram Raju

How to change image in list according to list data?

Posted: Mon Sep 21, 2015 4:34 am
by Vikram Raju

Thats how I implemented the code


How to change image in list according to list data?

Posted: Mon Sep 21, 2015 4:54 am
by Vikram Raju