Find more Examples here

Basket (FlexView-API)

Version reduced to minimal set of HTML Read Example Description


Selected tours (id list):
Usage: Click on a tour's list item or infowindow to add it to the selection.

Description

var fvp;

var layer;
//var fvp;

// an array holding the ids of the selected OOIs
var selectedObjects = [];

// FlexView API configuration
var conf = {

    "frontendtype": "tour", 

    "modes": ["gallery",  "map", "list", "listMap"],
    "initMode": "listMap", 

    "withUrlHash": false,

    "center": [ 10.2210235, 47.560012 ], 
    "zoom": 10,

    // do not open detail view when an OOI is selected
    "actionOpenType": "none",

    // an OOI is clicked: map marker, infowindow, list entry, ...
    "onOoiClick": onOoiClickCallback

};

fvp = oa.api.flexviewpage( conf );

// list of radio buttons (used to switch between "all content" and "selected content")
var radioButtons = document.getElementsByName("flexViewContent");

// attach click handler to all radio buttons
for(var i=0; i<radioButtons.length; i++) {
    radioButtons[i].onclick = onRadioButtonClickCallback;
}

// 
function onOoiClickCallback(obj, event) {

    // ignore clicks on map marker (infowindow is opened)
    if ( event != "mapMarker" ) {

	// all OOIs of the project are shown right now ?
	if (document.getElementById("projectContent").checked) {

	    // add OOI id to list of selected objects
            if ( selectedObjects.indexOf( obj.id )<0 ) {
		selectedObjects.push( obj.id );
            }

	}

	// only the selected OOIs are shown right now
	else {

	    // remove OOI id from list of selected objects
            selectedObjects.splice( selectedObjects.indexOf( obj.id ), 1 );

	    fvp.setDataPointList( selectedObjects );

	}

	if (selectedObjects) {
	    document.getElementById( "selection" ).value = selectedObjects.join(",");
	}

    }

}

// radio buttons click handler
function onRadioButtonClickCallback( c ) {

    // switch to "all content" ?
    if (c.target.value=="project") {

	// call setDataPointList() without arguments to show all content of a project
        console.error("sdpl");
	fvp.setDataPointList();

	document.getElementById("hintProjectContent").style.display = "block";
	document.getElementById("hintSelectedContent").style.display = "none";

    }
    // switch to "selected content"
    else {

	// show selected OOIs
	fvp.setDataPointList( selectedObjects );

	document.getElementById("hintProjectContent").style.display = "none";
	document.getElementById("hintSelectedContent").style.display = "block";

    }

}