Manoj
Posts: 0
Joined: Mon Oct 14, 2013 7:11 pm

Listitem Split Icon change with Click Event

Hello!

I am learning Appery. I created a list and populated it with RESTapi and mapped the listitem image and text with the data from RESTapi response. The list has split icons which is set to "+" on load. Now, with the populated data, I am trying to change the split icon to "-" when the user clicks on it through the click event and javascript. However, the icon does not change. In fact the click on the split icon does not do anything.

Can you tell me how to add click events to the split button when the listitems are populated through REST.

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

Listitem Split Icon change with Click Event

Hello! If you've added something to List item through editor - List item looses split button. If you need to map a few elements (image, text) to List item and have split button at the same time then it's better do not add elements through editor, but in mapping using JS. In this case split button will work in editor and you can add needed events for it inside editor.

Manoj
Posts: 0
Joined: Mon Oct 14, 2013 7:11 pm

Listitem Split Icon change with Click Event

I am not sure how to add split buttons in JS.

Thanks!

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

Listitem Split Icon change with Click Event

Hello! Perhaps you need CollepsibleSet. To change icons use the following code:
prevar arr = Appery("mobilecollapsibleset_17").find("[data-role=collapsible] a span span:nth-child(2)");
arr.each(function(e){
bb.removeClass("ui-icon-plus");
bb.addClass("ui-icon-minus");
});/pre

Return to “Issues”