Given the following code, I’m trying without success to achieve the following two goals:
- when a
MapMarker
is tapped only the data of that marker is shown in the openedEdgeNavigator
- when a
category
tab is tapped the map should display only the markers relative to the tapped category
<App>
<JavaScript>
var Observable = require("FuseJS/Observable");
var GeoLocation = require("FuseJS/GeoLocation");
var data = Observable();
var json = {
"events": [
{
category: "Music",
items: [
{"ID": "34", "latitude": "45.6471393", "longitude": "13.7762199"},
{"ID": "12", "latitude": "45.6477503", "longitude": "13.7656562"}
]
},
{
category: "Theatre",
items: [
{"ID": "64", "latitude": "45.6526666", "longitude": "13.7838803"}
]
},
{
category: "Shows",
items: [
{"ID": "87", "latitude": "45.6519166", "longitude": "13.7821208"},
{"ID": "56", "latitude": "45.6511967", "longitude": "13.7777434"},
{"ID": "99", "latitude": "45.6455902", "longitude": "13.7616651"}
]
}
]
};
data.replaceAll(json.events);
module.exports = {
data: data,
onMarkerTapped: onMarkerTapped
};
function onMarkerTapped(args) {
console.log("Marker press: " + args.label);
EdgeNavigator.open("Bottom");
}
</JavaScript>
<NativeViewHost>
<EdgeNavigator ux:Name="EdgeNavigator">
<Sidebar ux:Name="menu" Edge="Bottom">
</Sidebar>
<MapView Latitude="45.6471390" Longitude="13.7762199" Zoom="14" MarkerTapped="{onMarkerTapped}" ShowMyLocation="True" ShowMyLocationButton="True">
<Each Items="{data.items}">
<MapMarker Latitude="{latitude}" Longitude="{longitude}" Label="{ID}" />
</Each>
</MapView>
</EdgeNavigator>
</NativeViewHost>
<!-- ====================================================================== -->
<StackPanel ux:Class="Sidebar" Background="#37474F">
<DockPanel Dock="Top">
<ScrollView AllowedScrollDirections="Horizontal">
<PageIndicator Navigation="slides" Orientation="Horizontal" Margin="6,6,6,6">
<StackPanel Dock="Top" ux:Template="Dot" Width="100" Height="200">
<Rectangle Height="40">
<SolidColor Color="#FFFFFF" />
<Text TextAlignment="Center" Alignment="Center" Value="{Page Title}" TextWrapping="Wrap" Color="#000000"/>
<Clicked>
<NavigateTo Target="{Page Visual}"/>
</Clicked>
</Rectangle>
</StackPanel>
</PageIndicator>
</ScrollView>
<PageControl ux:Name="slides">
<Each Items="{data}">
<MyPage Title="{category}" />
</Each>
</PageControl>
</DockPanel>
</StackPanel>
<!-- ====================================================================== -->
<Page ux:Class="MyPage">
<ScrollView Margin="0,50,0,0">
<StackPanel ItemSpacing="6" >
<Each Items="{items}">
<Text Value="{ID}" Color="#FFFFFF"/>
</Each>
</StackPanel>
</ScrollView>
</Page>
</App>