Lucas Cranach
Posts: 0
Joined: Fri Jun 13, 2014 2:16 am

Getting relative values from Collapsible UI component

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?

Aeneas McBurney
Posts: 0
Joined: Mon Jun 16, 2014 7:49 am

Getting relative values from Collapsible UI component

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

Rox
Posts: 0
Joined: Mon Jun 23, 2014 5:23 am

Getting relative values from Collapsible UI component

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

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Getting relative values from Collapsible UI component

Hi Aeneas,

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

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Getting relative values from Collapsible UI component

Hi Rox,

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

Aeneas McBurney
Posts: 0
Joined: Mon Jun 16, 2014 7:49 am

Getting relative values from Collapsible UI component

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?

Aeneas McBurney
Posts: 0
Joined: Mon Jun 16, 2014 7:49 am

Getting relative values from Collapsible UI component

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.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Getting relative values from Collapsible UI component

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

Aeneas McBurney
Posts: 0
Joined: Mon Jun 16, 2014 7:49 am

Getting relative values from Collapsible UI component

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!

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

Getting relative values from Collapsible UI component

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.

Return to “Issues”