I have an array in localstorage and would like to add a delete button to allow enduser to delete an item from this list
I have an array in localstorage and would like to add a delete button to allow enduser to delete an item from this list
Hello!
You can delete an item with this function
code
function removeArrayItem(varName, itemValue) {
var arr = myLoad(varName);
if(arr.indexOf(itemvalue) != -1) {
arr.splice(arr.indexOf(itemvalue));
localStorage.setItem(varName, JSON.stringify(arr));
}
} /code
To get selected item from selectmenu1 use following code:
code Tiggr('selectmenu1').val()/code
thanks Katya,
I didn't get it to work, heres what I did
1 create new java, pasted script
function removeArrayItem(varName, itemValue) {
var arr = myLoad(varName);
if(arr.indexOf(itemvalue) != -1) {
arr.splice(arr.indexOf(itemvalue));
localStorage.setItem(varName, JSON.stringify(arr));
}
}
on click event add, run custom javascript
Tiggr('mobileselectmenu1').val()
can you tell me what it may be
cheers
Try adding following JS code on click event:
code
removeArrayItem('variable_name', Tiggr('mobileselectmenu2').val());
setSelectMenuOptions(Tiggr('mobileselectmenu2'), myload('variable_name'));
/code
No luck Katya,
added script, no change, I can share if you wish
Yes, please share your project with support@tiggzi.com. We will test and I'll update.
thank you Katya,
now shared
There is a mistake. Please correct your JS in click event. There must be "mobileselectmenu1" instead of "mobileselectmenu2".
Thank you Kayta,
I should have seen that, sorry.
Works great on browser but when loaded on android galaxy ace, white screen only, app installs but only white screen shows, any Ideas why?
We are testing. I will update.