Bernie
Posts: 0
Joined: Fri Jul 27, 2012 2:06 pm

How can pick the value from a mobileList?

I filled a mobileList with values from a Json file
(CategoryList.append('a rel="nofollow"'+val.Category+'/a');)

Everything works fine. All my entries are shown in the list.
Now I want to pick the value of any of those list entries and pass it to the local storage. How can I do that? I tried this.value, but without luck.

Any suggestions appreciated.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How can pick the value from a mobileList?

Use click event, and save a value into local storage. You will find an example here: http://help.gotiggr.com/getting-start...

Bernie
Posts: 0
Joined: Fri Jul 27, 2012 2:06 pm

How can pick the value from a mobileList?

I used the click event. It works, but the result is always an empty value.
Is it, cause I did not map anything?
When mapping, the results of the json entries always end up in a label that is inside the list item. I d not have a label inside my list items.

Bernie
Posts: 0
Joined: Fri Jul 27, 2012 2:06 pm

How can pick the value from a mobileList?

Here is the complete coding of how I filled the list:

var CategoryList = Tiggr('mobilelistCategory');
CategoryList.empty();

var count = data.Entries.length;

for (var i=0; i < count; i++) {

$.each(data, function(key, val) {
if (i 0) {
if (val.Category != val[i-1].Category) {
CategoryList.append('a rel="nofollow"'+val.Category+'/a');
}
}
});
}

CategoryList.listview("refresh");

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How can pick the value from a mobileList?

Well.. you do need to map something. Did you see the example in the previous post? When you display the list, you would add a hidden value. That hidden value you would save into local storage on click.

Bernie
Posts: 0
Joined: Fri Jul 27, 2012 2:06 pm

How can pick the value from a mobileList?

ok, got you. Will do so.Thanks

Bernie
Posts: 0
Joined: Fri Jul 27, 2012 2:06 pm

How can pick the value from a mobileList?

Image

I am sorry to bother you again. I'm simply not getting the value of the selected list item. I do not want to pass it to another page. I only need to have that value.

I've tried with running a script as a click event on the multilistitem:
var $this = $(this);
alert($this(1).text());

== no value

The suggested way described under http://help.gotiggr.com/getting-start... desn't work either. Saving the Text property in a local storage variable returns null!

I've got the feeling, that something is wrong with populating the list on the screen. It appears to be right but behaves some kind of strange.

When mapping my restservice, passing variables over with the local storage worked always fine in the past. But this time I had to fill my list with java script instead of mapping it, because the array I need comes with duplicates I don'T want to display on the scren.

Thanks

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How can pick the value from a mobileList?

$(this) -- probably won't work as it returns the current element which is a jQuery Mobile component. If you need traverse the DOM and select the label component from this element. Then you will be able to save it into local storage.

Bernie
Posts: 0
Joined: Fri Jul 27, 2012 2:06 pm

How can pick the value from a mobileList?

I get the mobilelist and add my values with mobilelist.append...
Can you give an example how to fill the labels of my list? Do I have to use toArray() ?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How can pick the value from a mobileList?

Well.. by labels I mean the text value that you have in the list. So you don't actually have to create them, they are already there.

Return to “Issues”