Kirit Vaghela
Posts: 0
Joined: Tue Aug 27, 2013 11:23 am

De-select list item

Hello,
I want make the App that save the checklist selections so that if I check three boxes there, then close the screen or close the app and go back there - those three checkboxes will still be checked.

for Storing selected checklist I use following code on Value change event of mobilecheckboxgroup

var ourFinalArray = [];

Appery("mobilecheckboxgroup_23").find("input:checked").each(function(){
ourFinalArray.push($(this).val());

});
localStorage.setItem("names",JSON.stringify(ourFinalArray));

Now How can I retrieve all selected items from localStorage and check the listview item according on load of page.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

De-select list item

Hello! Use the following code:
codevar namesArray = JSON.parse(localStorage.getItem("names"));

Appery('mobilecheckboxgroup_21').find("input").each(function() {
if (namesArray.indexOf($(this).val()) != -1) {
$(this).attr("checked", "checked").refresh();
}
});/code

Return to “Issues”