YoshiTiquish
Posts: 0
Joined: Sat Apr 19, 2014 9:31 am

Add or Remove ListItem from List Manually

How do I add a List Item manually?

How do I remove current selected item from the list?

Thanks.

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

Add or Remove ListItem from List Manually

Hi Yoshi,

You can add this event handler for listitem: pre$(this).parent().remove();
Apperyio("mobilelistName").find("li:nth-child(1)").addClass();/preWhere 'mobilelistName' is a list component name.

xman
Posts: 0
Joined: Sun Jul 06, 2014 7:05 pm

Add or Remove ListItem from List Manually

I don't fully understand the addition part here and would appreciate if someone could help. I have a mobilelist item on a page, and a text label placed inside the list item. For my application, I need to grow this list every time a button click is done. For example, the list should grow incrementally on every button click as follows:

January
February
March
April
....
...so on.

This means, I have to manually increment the list, but I have no idea how to do that. Please help.

xman
Posts: 0
Joined: Sun Jul 06, 2014 7:05 pm

Add or Remove ListItem from List Manually

I don't fully understand the addition part here and would appreciate if someone could help. I have a mobilelist item on a page, and a text label placed inside the list item. For my application, I need to grow this list every time a button click is done. For example, the list should grow incrementally on every button click as follows:

January
February
March
April
....
...so on.

This means, I have to manually increment the list, but I have no idea how to do that. Please help.

xman
Posts: 0
Joined: Sun Jul 06, 2014 7:05 pm

Add or Remove ListItem from List Manually

ping! ..anyone?

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Add or Remove ListItem from List Manually

Hello Xman,

pre.addClass();/pre
Was added accidentally.
[quote:]but I have no idea how to do that.[/quote]
1) Please find item that has :
data-appery-tpl="true"
attribute
http://gyazo.com/9fab3879237a981307ac...
2) clone it
3) append to your list

There is another way: you can map LSV which will have to be an array
Much easier to add element to the array and map array, so Appery.io will do all the hard work
You can find how to map array to the selectmenu here
http://blog.bismallion.com/map-appery...

xman
Posts: 0
Joined: Sun Jul 06, 2014 7:05 pm

Add or Remove ListItem from List Manually

The first solution I completely don't understand.

I understand the second solution, but my issue is that I need a way to "append" to an LSV array, not "set". The issue is that the service I have only returns one element at a time in response. I run this service many times and want that each time the single value returned by this service is pushed onto my LSV array.

There is Appery.io.storage.myarray.set in this example, is there something which I can use to append to my array?

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

Add or Remove ListItem from List Manually

Hi -

myarray is a localStorage variable, so you could use only set and get methods to it, there is no 'append'.
But you can create new array from old value of Apperyio.storage.myarray and your response. And set this new array to Apperyio.storage.myarray. You can do it in such way:
pre
code
/* your response /
var yourNewArrayElement = {"name":1, "value":1};
/ we get old value of Apperyio.storage.myarray /
var temp_arr = Apperyio.storage.myarray.get();
/ Append your response to value of Apperyio.storage.myarray /
temp_arr.append(yourNewArrayElement);
/ set Apperyio.storage.myarray new value */
Apperyio.storage.myarray.set(temp_arr);
/code/pre

xman
Posts: 0
Joined: Sun Jul 06, 2014 7:05 pm

Add or Remove ListItem from List Manually

Can you elaborate a bit on the data-aperry-tpl="true" solution above. I think this might work for me, but I am confused how to implement it?

xman
Posts: 0
Joined: Sun Jul 06, 2014 7:05 pm

Add or Remove ListItem from List Manually

Can anyone please elaborate a bit on the data-aperry-tpl="true" solution above. I think this might work for me, but I am confused how to implement it?

Return to “Issues”