M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

list component - add list item with value

When adding an item to a "Select" Component, this is how I do it
code
var dropDown = $('[name=selectComponent]');
dropDown.html('');

dropDown&#46;append('<option value="' + itemValue + '">' + itemDisplayname + '</option>');
/code

So how do I add an item similarly to a list item but with a value. I can use the append to add items to list component but how do I specify the value?

Thanks

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

list component - add list item with value

Hello M&M,

List in Appery.io is jQuery Mobile Listview widget, you can learn more about it in general here: http://api.jquerymobile.com/listview
To add new list item you can inspect li item in browser, please see its structure (for example http://gyazo.com/a681b1924b0ee5d4784a...), and add the new item with similar structure.
Use refresh full list after adding new item http://api.jquerymobile.com/listview/...

M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

list component - add list item with value

When I use a REST API and populate a List Item, I can map a numeric value to the "Counter Value" of list item. For example if you look at the image below

Image

How do I assign the counter value if I am adding list items programmatically - using javascript / jquery?

If I am able to set that value when using a REST service I should also be able to assign it using javascript / jquery. I hope you understand what I am trying to say here.

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

list component - add list item with value

MY&M,

You have to add such structure: http://gyazo.com/72cd396b2fb2745e1ca6...
You can see that if you inspect the element with counter

M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

list component - add list item with value

Thanks Evgene

Return to “Issues”