mcgrathken.kmg
Posts: 0
Joined: Sat Feb 04, 2012 6:03 pm

Clickable list problem

Hi Max

I'm simply trying to get vaue of a clicked item in my list named "Productlist".
I'm using jQuery function
$('#Productlist li').click(function(){
var $this = $(this);
alert($this.text() + ' \nIndex ' + $this.index());
})

This will not even show alert box.
I am invoke the above on-click event of the ProductListitem.
Perhaps it may be done using Tiggr API ?

Thanks Max

Julia Babenko
Posts: 0
Joined: Fri Feb 24, 2012 7:49 am

Clickable list problem

You can add Click event on mobilelistitem with this code:

var $this = $(this);
alert($this.text() + ' \nIndex ' + $this.index());

mcgrathken.kmg
Posts: 0
Joined: Sat Feb 04, 2012 6:03 pm

Clickable list problem

Hi Julia

Thanks for that, it worked.
I was calling the function when i didn't need to
Whats the easiest way to store the clicked item into localstorage.
I am using
var prod = localStorage.setitem("key1","value1");

but when i debug in Chrome i cannot see the clicked item in the list.

thanks

Julia Babenko
Posts: 0
Joined: Fri Feb 24, 2012 7:49 am

Clickable list problem

var prod = localStorage.setItem("key1","value1"); - this should work (correct setItem method)

mcgrathken.kmg
Posts: 0
Joined: Sat Feb 04, 2012 6:03 pm

Clickable list problem

Hi Julia
I have been working on localstorage but i cannot get it to work.
My list if products is named "Productslistitem"
my items which are stored within a label within the list is named "ProductLabel"
what am i doing wrong?
I just want the item clicked stored appended to localstorage.
Tiggzi keeps freezing on me when it tries to do an auto save.
In order to fix this i have to close my browser and reload the app (screenshot below) :-(
Thanks Julia Image

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

Clickable list problem

It's not clear what the problem is, can you post code and show how it works and how it should work?

As for freezing -- does that happen only if you use autosave or when clicking Save button?

mcgrathken.kmg
Posts: 0
Joined: Sat Feb 04, 2012 6:03 pm

Clickable list problem

Hi Max
Sure. I have a a list named "Productslistitem" inside it i have a label named "ProductLabel"

I am trying to store each clicked item in the list to localstorage.
I am using custom javascript on click event of the list.

------------------------------------------------------------------------

//var prod = $(this);
//alert($this.text() + ' \nIndex ' + $this.index());
var prod = localStorage.setItem("key1","value1");

------------------------------------------------------------------------

As i have declared var prod i presume that i dont need to set local varible as shown below
Image Image

mcgrathken.kmg
Posts: 0
Joined: Sat Feb 04, 2012 6:03 pm

Clickable list problem

The freezing only happens when it auto saves.
This only happens sporadically.
Some days it doesn't happen and other days it happens very frequently.
I understand difficult to pinpoint as answer is very vague, however, I will monitor this strange behaviour and keep you posted
Thanks Max

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

Clickable list problem

Is this the code that you use?

code
localStorage.setItem("key1","value1");
/code

It should work but it will overwrite the previous entry on every new click.

mcgrathken.kmg
Posts: 0
Joined: Sat Feb 04, 2012 6:03 pm

Clickable list problem

Hi Max

Yes this is what i use but i dont see anything stored in localstorage.
It should be storing all clicked items in the list.
They are all strings so it should be ok.

Return to “Issues”