Page 2 of 4

Getting relative values from Collapsible UI component

Posted: Sat Jun 21, 2014 2:24 am
by Lucas Cranach

We need to know how to reference the collapsible items in each mapped collapsible area. Ive read something about $(".selector").collapsible("option") but not sure how to use it. Am I on the right track?


Getting relative values from Collapsible UI component

Posted: Mon Jun 23, 2014 2:22 am
by Aeneas McBurney

This is a related question in that I have this code to display the messages using different colours for read or unread items. However it sets all of the elements based on the last result. How do I refer to each element within collapsible

Code:

if (value === false) {
$("[name=lblMsgRead]").css("background-color","green");

} else {
$("[name=lblMsgRead]").css("background-color","red");
}

Screenshot:

Image


Getting relative values from Collapsible UI component

Posted: Mon Jun 23, 2014 5:23 am
by Rox

I'm also having the same issue and have tried a few ways to get around this. None of them have worked.

1st way: Tried to save label text to a local variable from Events menu. This does not week. (Bug?)

Image Image

2nd way: I'm trying to use the localStorage.setItems function but I can't get the value from the list.
I've tried a lot of variations and none have worked:
1) alert(Appery("listUserId").text());
--- this gets only the first value in the list

2) alert( Appery('listUserId', this).text() );
---- this is null or undefined.

3) jQuery('[name="listUserId"]').text()
---- this returns the entire list of IDs


Getting relative values from Collapsible UI component

Posted: Mon Jun 23, 2014 9:06 am
by Kateryna Grynko

Hi Aeneas,

Use the following code to set a background for all lblMsgRead child elements: preApperyio("lblMsgRead").find("*").css("background-color","red");/pre


Getting relative values from Collapsible UI component

Posted: Mon Jun 23, 2014 9:07 am
by Kateryna Grynko

Hi Rox,

Run the following code on listitem Click event to save a listUserId value:prelocalStorage.setItem("listUserId", $(this).find("[name=listUserId]").text());/pre


Getting relative values from Collapsible UI component

Posted: Mon Jun 23, 2014 9:41 am
by Aeneas McBurney

Thanks for your response.

I have a label and button inside a collapsible (which is inside another collapsible)and the onclick event does this command

alert($(this).find("[name=lblMatchid]").text());

However I'm getting a blank alert even though there's a value showing in lblMatchid at runtime.

Any ideas?


Getting relative values from Collapsible UI component

Posted: Mon Jun 23, 2014 9:46 am
by Aeneas McBurney

Thanks Katya but I need to set the style of each element depending on the value in the json data set that populates the collapsibles. So above false should be green and true red for example.


Getting relative values from Collapsible UI component

Posted: Mon Jun 23, 2014 5:46 pm
by Evgene Karachevtsev

Hello Aeneas,

Please provide us with more details. By clicking on what element do you call this code? If it is button, then most likely, you should use this code:

codealert($(this).parent().find("[name=lblMatchid]").text());/code


Getting relative values from Collapsible UI component

Posted: Mon Jun 23, 2014 11:58 pm
by Aeneas McBurney

Hi Evgene, that work perfectly and is exactly what I was after. Thanks for your help. I am now just awaiting a response from my question to Katya above.

Thanks!


Getting relative values from Collapsible UI component

Posted: Tue Jun 24, 2014 2:58 am
by Alena Prykhodko

Aeneas,

Use this code:

pre
if (value == false) {
Apperyio("startScreen").find($('div[dsid="mobilelabel_x"]')).css("background-color","green");

} else {
Apperyio("startScreen").find($('div[dsid="mobilelabel_x"]')).css("background-color","red");

} /pre

where startScreen - your page name or Collapsblock component name;
mobilelabel_x - your label component name.