我想链接我的两个过滤器,以获取我的谷歌地图过滤器的特定过滤器,如果按类别的过滤器标记已获得值,我希望按会话过滤器从按类别过滤器中获取值,然后与我的按会话过滤。
这是我的代码,按类别和会话过滤:
// filter markers by category
filterMarkers = function (category) {
for (i = 0; i < gmarkers1.length; i++) {
marker = gmarkers1[i];
// If is same category or category not picked
if (marker.category == category || category.length === 0) {
marker.setVisible(true);
}
// categories don't match
else {
marker.setVisible(false);
}
}
}
// filter markers by session
filterMarkersx = function (session) {
for (i = 0; i < gmarkers1.length; i++) {
marker = gmarkers1[i];
// If is same session or session not picked
if (marker.session == session || session.length === 0) {
marker.setVisible(true);
}
// session don't match
else {
marker.setVisible(false);
}
}
}
这是我的选项选择代码来获得价值:
<div class="controls">Filter By :
<select id="type" onchange="filterMarkers(this.value);">
<option value="">Merchant Grub</option>
<option value="STARBUCKS">STARBUCKS</option>
<option value="SIMPLY">SIMPLY</option>
<option value="SHIHLIN">SHIHLIN</option>
<option value="RE JUVE">RE JUVE</option>
<option value="PUYO">PUYO</option>
<option value="LOTTERIA">LOTTERIA</option>
<option value="KFC">KFC</option>
<option value="HOP HOP">HOP HOP</option>
<option value="DOMINOS">DOMINOS</option>
<option value="CIRCLE K">CIRCLE K</option>
<option value="CHATIME">CHATIME</option>
<option value="CFC">CFC</option>
<option value="BURGER KING">BURGER KING</option>
<option value="BREADLIFE">BREADLIFE</option>
<option value="BAKMI GM">BAKMI GM</option>
<option value=" AUNTIE ANNE'S">AUNTIE ANNE'S</option>
</select>
</div>
<div class="controls">Filter By :
<select id="type" onchange="filterMarkersx(this.value);">
<option value="">IN SESSION</option>
<option value="false">FALSE</option>
<option value="">TRUE</option>
</select>
</div>
如何链接我的两个过滤器?
例如:如果我在按类别过滤中选择了starbucks,在按会话过滤中选择了false,我可以得到值starbucks false session。
提前致谢,
海妖