Check checkbox in list
I have a list of items populated from the REST service.
User adds items into the "shopping cart" by checking clicking the list item.
Shopping cart is stored in local array.
There is a check box in the list item to indicate if the item is added or not.
User can switch "categories" which triggers new REST service call and refresh of the list item.
I want to be able to populate checkboxes of items in the shopping cart when user returns to the original category.
This is the code I have in Mapping of the REST service on the Checkbox Checked property
var uniQID=value;
try {
Code: Select all
// Get cart
var cart = Apperyio.storage.cart.get() || [];
//Loop through all cart items
for (var i = 0; i < cart.length; i++)
{
//Search for the same item id
if ((cart[i].IdUniQ == uniQID) )
{
return 1;
} else {
return 0;
}
} }
catch (error) {
alert("Something went wrong: ", error);
}
Only the first checked item gets retained when I return to original category. what am I missing?
Or is this a wrong approach?
Thanks