Gary Staab
Posts: 0
Joined: Wed Apr 24, 2013 3:30 pm

How do I bind the Appery click event to items dynamically added to a list using jquery append

My application is dynmically adding to a list element. The click event works for any items in the list when it was initially create, but and dynmically added items don't respond to the click event.

What is the easiest way to bind the click event added thru appery to these dynmically added items.

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

How do I bind the Appery click event to items dynamically added to a list using jquery append

Hi Gary,

There are two ways.

1) Create new List Item. On new List Item click run the following JavaScript:
codeAppery('mobileListItem').trigger('click')/codeAction added on click event for component 'mobileListItem' will be executed.

2) If new List Item name is the same as the List Item name then on the new List Item click Actions from the old List Item will be executed.

bahar.wadia
Posts: 0
Joined: Wed Aug 07, 2013 2:05 am

How do I bind the Appery click event to items dynamically added to a list using jquery append

Hello Katya,

I have the exact need.

I have tried your suggestion, but I don't think I have quite understood your recommendation. Below is a snippet of my code...what am I doing wrong ?

var Items = arguments[0];

Items.sort();

var FoundList = Appery("mobilelist_FoundItems");

FoundList.empty();

//Appery('mobilelist_FoundItems').trigger('click'); // This does not work

$.each(Items, function(index, option)
{
FoundList.append('' + option + '');
//Appery('mobilelist_FoundItems').trigger('click'); // This does not work, either
});

FoundList.listview("refresh");

bahar.wadia
Posts: 0
Joined: Wed Aug 07, 2013 2:05 am

How do I bind the Appery click event to items dynamically added to a list using jquery append

I have debugged the application.

If I don't .empty() the List and simply .append() new items the first item is clickable, but all the appended items are not clickable.

If I .empty() the List and then .append() new items nothing is clickable.

Please read my questions again. Your response is not answering my questions.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

How do I bind the Appery click event to items dynamically added to a list using jquery append

Hello! Instead preFoundList&#46;append('<li>' + option + '<&#47;li>');/pre please try
preFoundList&#46;append('<li> <a name="mobilelist_FoundItems_ITEMNAME">' + option + ' <&#47;a> <&#47;li>');/pre
where mobilelist_FoundItems_ITEMNAME - name of item in List mobilelist_FoundItems where you add event

Return to “Issues”