Ram
Posts: 0
Joined: Fri Aug 02, 2013 12:15 pm

List within a list

Dear Appery,

i have a list within a list:

Image

the child list (blue) is invisible to the user, how can i read the labels text in the child list when clicking on the parent (green) list?

Many thanks in advance!
Best,
R.

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

List within a list

Hi Ram,

Add the following click event handler for a parent item:prevar list = $(this).find("[data-role=listview] li");
var arr = [];
list.each(function(e){
arr.push($(list[e]).text());
});/preThen you get an array 'arr' containing texts of a child list.

Ram
Posts: 0
Joined: Fri Aug 02, 2013 12:15 pm

List within a list

YES!!! PERFECT!!!

Image

Ram
Posts: 0
Joined: Fri Aug 02, 2013 12:15 pm

List within a list

since i had to change the nested list to a grid component , what is the correct code instead of the following one published by Katya?

precode
var list = $(this).find("[data-role=listview] li");
var arr = [];
list.each(function(e){
arr.push($(list[e]).text());
});
/code/pre

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

List within a list

Hi Ram, sorry but it's not very clear what you want to do.

Ram
Posts: 0
Joined: Fri Aug 02, 2013 12:15 pm

List within a list

Hi Illya,

thank you for your reply.

i had a list within a list, the child list held an array that was mapped into labels; the code that Katya published loop though all the labels once the parent list item was clicked and filled the variant "arr" with all the text the labels held.

since then i had to replace the child list to a grid, now the grid holds the array that is mapped into labels, my question is what is the correct code to retrieve the text of the labels from the grid once the parent list item is clicked?

Ram
Posts: 0
Joined: Fri Aug 02, 2013 12:15 pm

List within a list

got it, thx anyways.

code
var list = $(this).find("tbody");
/code

Return to “Issues”