you're on the right track with using a collection to hold table information for your gallery. Let's troubleshoot and ensure everything is set up correctly.
-
Collection Initialization: Your ClearCollect function looks correct. It initializes colNavItems with the specified items. Ensure this code is placed in the OnStart property of your app or in a button's OnSelect property for testing purposes.
-
Gallery Items Property: Make sure your gallery's Items property is set to colNavItems. This binds the collection to the gallery.
-
Component Custom Property: If your Mega Menu Container component has a custom property named Items, you need to pass colNavItems to this property. For example, if your component is named MegaMenu, you can set its Items property like this:
MegaMenu.Items = colNavItems
4. Binding Data to Gallery Controls: Inside your gallery, bind the controls (e.g., labels, images) to the fields in your collection. For example:
- Set the
Text property of a label to ThisItem.Text
- Set the
Image property of an image control to ThisItem.icon
Here's a step-by-step example:
-
App OnStart Property:
ClearCollect(colNavItems,
Table(
{Text: "Balloons", Screen: 'Balloon Screen', icon: imgBalloon},
{Text: "Golf", Screen: 'Golf Screen', icon: imgGolf},
{Text: "Automobiles", Screen: 'Automobile Screen', icon: imgCars}
)
);
2.-Gallery Items Property:
colNavItems
Component Items Property:
MegaMenu.Items = colNavItems
-
Binding Data in Gallery:
- Label
Text property: ThisItem.Text
- Image
Image property: ThisItem.icon