issue with list item pointing

This forum contains topics that were moved from Get Satisfaction
Manish Kumar Singh
Posts: 0
Joined: Fri May 22, 2015 6:22 am

issue with list item pointing

Post by Manish Kumar Singh »

Hi,

I have a list item created with service response, every item has a respective value either true or false . I want to point each record record with regard to their value (true/false).

If record has value true then it show "label1", and if it has false then it show label2.

For that i created a local storage variable mapped with that component,
when I put alert on that variable it is showing thier respective value, but when I am putting condition to show either "label1 or label2" it was changing the very first record only.

Also it is not working on page load, but I need it to be work on page load.

Javs Script code :

var cst = localStorage.getItem('cStatus');
var jnm = localStorage.getItem('jName');

if(jnm.cst=="true"){

Appery("statusTxt1").show();
Appery("statusTxt").hide();
}
else if(cst=="false"){
Appery("statusTxt").show();
Appery("statusTxt1").hide();
}
else{
Appery("statusTxt1").hide();
Appery("statusTxt").hide();
} Image

Pavel Zarudniy
Posts: 0
Joined: Mon Jul 06, 2015 8:56 am

issue with list item pointing

Post by Pavel Zarudniy »

Hi Manish,
You should use response mapping with invoking JavaScript to processing each response element - https://devcenter.appery.io/documenta...

Manish Kumar Singh
Posts: 0
Joined: Fri May 22, 2015 6:22 am

issue with list item pointing

Post by Manish Kumar Singh »

Hi Pavel,

I gone through this documentation,but It is not helpful for me.

If I am putting this (set local storage variable and Java Script) on click event of individual record then it is working, But on Page Load event it is not working.

Please give me some helpful response.

Manish Singh

Manish Kumar Singh
Posts: 0
Joined: Fri May 22, 2015 6:22 am

issue with list item pointing

Post by Manish Kumar Singh »

Hi Pavel,

I gone through this documentation,but It is not helpful for me.

If I am putting this (set local storage variable and Java Script) on click event of individual record then it is working, But on Page Load event it is not working.

Please give me some helpful response.

Manish Singh

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

issue with list item pointing

Post by Yurii Orishchuk »

Hi Manish,

Problem you have is in user Appery("componentName") code where it could not be using.

pre

Appery("statusTxt1").show();

/pre

Code above gets only first component on the page.

If you want to get this component in accordance to populated list item you need:

1 Open service success mapping where you populate this list.

2 Find link from "$" to list-item component.

3 Click on "JS" button.

4 And use here your code with following modifications .

pre

//Where "cStatus" is response parameter name.
var cst = value.cStatus;

//Where "jName" is response parameter name.
var jnm = value.jName;

if(jnm.cst=="true"){

element.find('[name="statusTxt1"]').show();
element.find('[name="statusTxt"]').hide();

}
else if(cst=="false"){

element.find('[name="statusTxt"]').show();
element.find('[name="statusTxt1"]').hide();

}
else{

element.find('[name="statusTxt1"]').hide();
element.find('[name="statusTxt"]').hide();

/pre

Regards.

Post Reply