Page 1 of 4

Add or Remove ListItem from List Manually

Posted: Mon Apr 28, 2014 5:44 am
by YoshiTiquish

How do I add a List Item manually?

How do I remove current selected item from the list?

Thanks.


Add or Remove ListItem from List Manually

Posted: Mon Apr 28, 2014 7:22 am
by Kateryna Grynko

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.


Add or Remove ListItem from List Manually

Posted: Thu Feb 05, 2015 9:02 am
by xman

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.


Add or Remove ListItem from List Manually

Posted: Thu Feb 05, 2015 9:02 am
by xman

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.


Add or Remove ListItem from List Manually

Posted: Thu Feb 05, 2015 1:28 pm
by xman

ping! ..anyone?


Add or Remove ListItem from List Manually

Posted: Thu Feb 05, 2015 1:30 pm
by Evgene Karachevtsev

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...


Add or Remove ListItem from List Manually

Posted: Sun Feb 15, 2015 3:09 pm
by xman

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?


Add or Remove ListItem from List Manually

Posted: Mon Feb 16, 2015 5:09 pm
by Illya Stepanov

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


Add or Remove ListItem from List Manually

Posted: Sun Apr 05, 2015 10:20 pm
by xman

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?


Add or Remove ListItem from List Manually

Posted: Sun Apr 05, 2015 10:20 pm
by xman

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?