Marvin JS Example - Toolbars with display settings

Back to index
Standard Education Reaction Markush Search Basic Search Reporting View 3D View 3D with Web services Search with Reaxys

In this example, you can change layout without reloading of the editor. Select the desired layout to rerender editor toolbars.

When you take a look at the source code, you can see that a listener function is bind to the change events of radio buttons. When a change event is invoked, the updateToolbars(value) function is performed. This function assembles a JavaScript object that describes display settings and call the setDisplaySettings(settings) function of the sketcher. Only give settings that you would like to overwrite. In this case, this is the toolbars property.

		var marvinSketcherInstance;

		$(document).ready(function handleDocumentReady (e) {
			// after editor in the sketch iframe is ready store its reference
			// and activate controls
			MarvinJSUtil.getEditor("#sketch").then(function (sketcherInstance) {
				marvinSketcherInstance = sketcherInstance;
			},function (error) {
				alert("Cannot retrieve sketcher instance from iframe:"+error);

		function initControls () {
			// change layout
			$("input[name='layout-group']").change(function(e) {
				var s = $(this).val();

		function updateToolbars(layout) {
				"toolbars": layout

Back to index