Page 1 of 3

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

Posted: Tue Apr 15, 2014 11:26 am
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


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

Posted: Tue Apr 15, 2014 11:33 am
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


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

Posted: Tue Apr 15, 2014 11:41 am
by Kateryna Grynko

Hi Ciccio,

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


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

Posted: Tue Apr 15, 2014 11:44 am
by ciccio

thanks


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

Posted: Thu Jan 29, 2015 1:40 pm
by milind dahikar

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


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

Posted: Sat May 23, 2015 6:40 pm
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


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

Posted: Tue May 26, 2015 1:26 am
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.


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

Posted: Tue May 26, 2015 5:01 pm
by RK

works well. Thanks a lot for your timely help


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

Posted: Fri Jun 05, 2015 9:32 am
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?


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

Posted: Fri Jun 05, 2015 9:54 am
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.