Search
Menu.fromJson Method
See Also
 






Deserializes items from a JSON string.

Namespace: MindFusion.Common.UI
File: Menu.js

 Syntax

JavaScript  Copy Code

function fromJson (json)

 Parameters

json

String. A string created by the toJson method.

 Example

The following code creates a Menu using an HTML element called "links" and loads the menu content from a json string:

JavaScript  Copy Code

var ui = MindFusion.UI;

document.addEventListener("DOMContentLoaded", function ()
{
  var menu = new ui.Menu(document.getElementById("links"));
  menu.theme = "blue";
  let menuItems =  '{ "title" : "Activities", "href" : "Activities.html", "title" : "About Us", "href" : "About-us.html" }'
  menu.fromJson(menuIyems);
  menu.render();
});

 See Also