ciccio
Posts: 0
Joined: Fri Jun 14, 2013 10:40 am

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

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?

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

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

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.

Return to “Issues”