Page 1 of 1

issue with list item pointing

Posted: Mon Jul 13, 2015 12:00 pm
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


issue with list item pointing

Posted: Mon Jul 13, 2015 3:10 pm
by Pavel Zarudniy

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


issue with list item pointing

Posted: Tue Jul 14, 2015 6:30 am
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


issue with list item pointing

Posted: Thu Jul 16, 2015 7:05 am
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


issue with list item pointing

Posted: Thu Jul 30, 2015 4:52 am
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.