Favoriting one or more items allows the user to access them more quickly.
Bookmarking allows to keep a set of items selected by the user. It is possible to use the component Firebase Session to associate them with a user account or keep them only on the user's device using the PandaSuite database. In this case, create a local variable to save the identifiers of the user-selected items and then display them in the app.
In the Paris City Guide app, the user bookmarks good deals (by clicking on the favorite icon) and finds them in a dedicated section of the app.
Save favorite item
Add a favorite button within your list item (in a component Collection List).
Create a local variable to save the identifiers of the user selected items and then display them in the application.
Go to the PandaSuite database. Create a variable of type Array to save one or more identifiers.
Rename this variable (it is called saved_items in this example)
When the user favorites an item, add the unique identifier of the current item to this variable.
Upon bookmarking, add an action: Interact with a database > PandaSuite database > Modify the data > saved_items
💡Tip: We don't add the unique id directly to this array, but an object (key/value) that contains that unique id. We then take the structure of our data source which allows us easily to reuse the display defined previously (with the simplified access functions By id etc...)
Display saved items
To display bookmarked items, create a new collection. Insert a component Collection List and use in source the variable the saved_items to display only bookmarked items.
Like Source, choose the variable saved_items (From a database >PandaSuite database).
You can copy and paste your old collection with its template and simply change the source or create a new one if you want a different display.
Select a text block and click on the Content data binding:
Do the same with all objects.