We'll start by creating a view that will contain the table.
Right click on Views to create a view. In the example, we named ours CityStats. Set it as a Coordinate layout and check the Page URL option if you want to create a page for this view (you can always add a page later if you want to).
The table needs to have Latitude and Longitude data for the map to show that location. Highlight and copy the following data:
|
Right click on the data property of the Table component and select Paste.
Your table will now display the data for 10 rows and 5 columns.
Next we'll make the view that will be display a map of the cities in our table.
In the Project Browser, right click on Views to create a view. Name the new view CityMaps. Set it as a Flex layout, so the map easily takes up all available space. Lastly, do not check the Page URL option, as we don't need a corresponding page.
Drag a Map component onto the CityMaps View.
Set the Map's Position.Grow property to "1" so it resizes to take up the entire view.
Double click on key, and enter value as the object name.
Double click on key, and enter "lng". This matches the lng (longitude) column from the Table on the CityStats view. This name must exactly match the column name in the table.
It's important that the object here is named "value". The perspective table we're going to embed the map into has a feature where content from each row in the table can be passed to its subview. This mechanism requires that the subview contain an object named "value". In So if you wanted the subview to be passed any of the values from it's parent row, simply make a "value" object, and add values to it where the keys match the name of the column on the table. |
Click OK, then click OK again to save the binding.
At this point, the init.center.lat property is bound to view.params.value.lat where view.params.value.lat's value is "value" instead of a valid latitude number. This will cause a Component Error which is expected. |
Click OK, then click OK again to save the binding.
At this point, the init.center.lat property is bound to view.params.value.lat where view.params.value.lat's value is "value" instead of a valid latitude number. This will cause a Component Error which is expected. |
Lastly, we need to tell the CityStats View to use CityMaps as its subview.