how to get the Appery('label').text on a click event on a list item via javascript

This forum contains topics that were moved from Get Satisfaction
ciccio
Posts: 0
Joined: Fri Jun 14, 2013 10:40 am

how to get the Appery('label').text on a click event on a list item via javascript

Post by ciccio »

i have a list built through a REST service that is invoked on a button click.
in each list item i have a grid and some labels that are populated with the rest.

i would like to catch the text of the lael in the list items on a click event because if the text reported in the label from the rest has some particula values i want to alert

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

how to get the Appery('label').text on a click event on a list item via javascript

Post by ciccio »

i tried to run
code
var acquistabile = Appery('label_acquistabile').text();
alert(acquistabile);
/code
on the list item's click event, but i get an empty alert.

if i try the same code with a label that is "static" and not populated by the rest i get the correct alert

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

how to get the Appery('label').text on a click event on a list item via javascript

Post by Kateryna Grynko »

Hi Ciccio,

On listitem Click event run:prealert($(this).find("[name=labelName]").text());/preWhere 'labelName' is a label name.

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

how to get the Appery('label').text on a click event on a list item via javascript

Post by ciccio »

thanks

milind dahikar
Posts: 0
Joined: Thu Jan 29, 2015 1:40 pm

how to get the Appery('label').text on a click event on a list item via javascript

Post by milind dahikar »

alert(Apperyio('labelName').text());

RK
Posts: 0
Joined: Sat May 23, 2015 6:40 pm

how to get the Appery('label').text on a click event on a list item via javascript

Post by RK »

Hi Kateryna, I have tried the above recommendation as well. But it does not work for me.
My problem statement is very similar. I have a grid with labels which get populated from the database output. After the output comes on the page, a click on the label (fetched from the database) should navigate to another page with the assigned text of the label. It always goes in as a blank to the next page. Please help urgently.
-RK

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

how to get the Appery('label').text on a click event on a list item via javascript

Post by Yurii Orishchuk »

Hi Rohit,

You need:

1 Add "click" event handler for "Grid" component(not for cell or label).

2 Use code to get value from label:

pre

var value = $(this).find("[name=labelName]").text();

alert("value = " + value);

/pre

Regards.

RK
Posts: 0
Joined: Sat May 23, 2015 6:40 pm

how to get the Appery('label').text on a click event on a list item via javascript

Post by RK »

works well. Thanks a lot for your timely help

RK
Posts: 0
Joined: Sat May 23, 2015 6:40 pm

how to get the Appery('label').text on a click event on a list item via javascript

Post by RK »

Hi Yurii,
This worked fine on the mobile emulator in desktop. However, when I downloaded the app onto my android phone, it is always selecting the first value in the list. On the desktop emulator it selects the value correctly and processes correctly. Am I missing something?

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

how to get the Appery('label').text on a click event on a list item via javascript

Post by Illya Stepanov »

Hi Rohit -

This is pretty strange behavior. Could you please show us yours exact code that you're using or provide us your app public link to test this.

Post Reply