Hi Maryna,
how exactly do I add this to my existing code?
on the mapping from _id to Fav_ON button i have the JS:
pre
var lsData = Appery.storage.Favourite.get();
if ( _.findWhere( lsData, { Source_Id: value } ) ) {
return true;
}
return false;
/pre
where Fav_ON is the button that informs users that the item is in their favourite collection.
I also have the same code, with the true and false swapped round, mapped to another button, Fav_OFF, which informs users that the item is not in their favourites collection.
The 'Favourite' model has 3 items, Name, Source_Id and FavCollection_Id.
I also have a 'FavouriteArray' model, where the 'FavouriteArray' type is the 'Favourite' model above. The 'favourite' collection is mapped to this.
I want each item, if pre( _.findWhere( lsData, { Source_Id: value } ) )/pre then the Fav_ON button show and the 'FavCollection_Id' for that item to be mapped to a label on the list item. This way all the items in the list that are also in the 'Favourite' collection will have the _id for the 'favourite' collection (FavCollection_Id) listed too.
The reason for me wanting to do this is it will then allow me to create a delete service that maps this label to _id of the 'favourite' collection.
Does my explanation make sense?
how would i add your code to my existing code to achieve this?
Thank you,
Joe