Page 1 of 1

Listitem Split Icon change with Click Event

Posted: Mon Oct 14, 2013 7:20 pm
by Manoj

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.


Listitem Split Icon change with Click Event

Posted: Mon Oct 14, 2013 8:15 pm
by Maryna Brodina

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.


Listitem Split Icon change with Click Event

Posted: Mon Oct 14, 2013 9:29 pm
by Manoj

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

Thanks!


Listitem Split Icon change with Click Event

Posted: Tue Oct 15, 2013 12:00 pm
by Maryna Brodina

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