Reply To: Dynamic Menu Population Not Supported

Home Forums Older releases 1.0.x + Bootstrap addon Dynamic Menu Population Not Supported Reply To: Dynamic Menu Population Not Supported

#2883
schellem
Participant

Actually I told you wrong error message when I attempt to use $.SmartMenus.Bootstrap.init();

JavaScript runtime error: Unable to get property ‘init’ of undefined or null reference

I have double checked and retried my code and yours (this is a weekend project) I have the latest SmartMenu and they are loaded on the page
SmartMenus jQuery Plugin Bootstrap Addon – v0.2.0 – June 1, 2015
SmartMenus jQuery Plugin – v1.0.0-beta1 – June 1, 2015

Below is exact code as I tried commented out are your suggestion and a couple things I tried. I can make this work with the last line $.fn.smInit() which is my tweak on jquery.smartmenus.bootstrap.js

 var liHtml = $("#menuTemplateBS").render(menuSections);
      $(jqMenuId).empty().append('<ul id="bsMenu" class="nav navbar-nav">' + liHtml + '</ul');
      //$.SmartMenus.Bootstrap.init();
      // $(jqMenuId + " ul").smartmenus('refresh');
      //$('#bsMenu').smartmenus('refresh');
      $.fn.smInit();

Here is my tweak to jquery.smartmenus.bootstrap.js that allows things to work. This is what lead me to the original post. Actually, I had to just a bit more but this is the gist. I don’t fully comprehend why this works and just how to properly resolve.


(function($) {

	// init ondomready
	//$( function() {
  $.fn.smInit = function() {
  

Register

You will be emailed a link to set your password.

Login

Lost password?