Page 1 of 1

Sliding Panels: how to get values of labels contained in a list (populated by a REST)

Posted: Mon Nov 11, 2013 2:56 pm
by ciccio

I have a Sliding panel containing a list populeted by an external REST Service.
in each list item i have 3 labels. one for description, one for id and one for url.
i would like to display on the list just the description
and on the click event of each list item do some actions like navigate to the url.

i can get the list item value by running on page load event the code:
code$('[name="list_allegati"]').find("li").each(function(){

$(this).click(function(){
// alert($(this).attr('id'));
alert($(this).val());
});
});
/code
but i don't know how to get the values of the laels contained in the list items.
could you help me?


Sliding Panels: how to get values of labels contained in a list (populated by a REST)

Posted: Mon Nov 11, 2013 3:59 pm
by Kateryna Grynko

Hi,

1) You don't have to add all the events manually. You can do this in builder. On click event add an action for the list item you want to map to.

2) If you want to do this manually via JS you should implement a search inside a list item. For example, use the following code instead of existing:preAppery("list_allegati").off().on("click", "li", function(){
var $this = $(this);
$label = $this.find("[dsid=labelName]");
alert($label.text());
}); /preWhere labelName is a name of a needed label inside the list item.