-
-
Notifications
You must be signed in to change notification settings - Fork 484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with last version 3.0.4 #178
Comments
Could you share your menu structure? |
Sure!
|
i don't see any problem. |
This is the complete example, that give the error. |
Nothing? :( |
The problem is that you created the DOM with jquery. But I haven't produced a solution yet. Can you try with metismenujs? |
Will try with that version, but it was working also with metismenu with the version available before the 3.0.4... |
It works in this way. But I don't know exactly what you want. var _SELECTED="3";
var _SUBSELECTED="VAL3";
var tabMenu=[{"MAIN":"Menu 1","VALUE":"1","LABEL":"Label 1","ID":"VAL1"}
,{"MAIN":"Menu 1","VALUE":"1","LABEL":"Label 2","ID":"VAL2"}
,{"MAIN":"Menu 2","VALUE":"2","LABEL":"Label 3","ID":"VAL2"}
,{"MAIN":"Menu 2","VALUE":"3","LABEL":"Label 4","ID":"VAL2"}
,{"MAIN":"Menu 3","VALUE":"1","LABEL":"Label 5","ID":"VAL3"}
,{"MAIN":"Menu 3","VALUE":"2","LABEL":"Label 6","ID":"VAL3"}
,{"MAIN":"Menu 3","VALUE":"3","LABEL":"Label 7","ID":"VAL3"}
,{"MAIN":"Menu 3","VALUE":"4","LABEL":"Label 8","ID":"VAL3"}
,{"MAIN":"Menu 3","VALUE":"5","LABEL":"Label 9","ID":"VAL3"}
,{"MAIN":"Menu 3","VALUE":"6","LABEL":"Label 10","ID":"VAL3"}
,{"MAIN":"Menu 3","VALUE":"7","LABEL":"Label 11","ID":"VAL3"}];
function composeMenu(tableMenu) {
var cList = $('#menu').empty();
var prevMain=null;
var ul=null;
$.each(tableMenu, function(index, row) {
if(row.MAIN !== prevMain) {
var li = $('<li/>')
.appendTo(cList);
var content = $('<a/>')
.text(row.MAIN)
.attr('href', '#')
.addClass('has-arrow')
.attr('aria-expanded', (row.ID === _SELECTED ? 'true' : 'false'))
.appendTo(li);
if(row.ID === _SELECTED) {
li.addClass('mm-active');
content.addClass('mm-has-active-menu');
}
ul=$('<ul/>')
.appendTo(li);
prevMain=row.MAIN;
}
var li = $('<li/>')
.appendTo(ul);
var content = $('<a/>')
.text(row.LABEL)
.attr('href', '#')
.appendTo(li);
if(row.ID === _SELECTED && row.VALUE === _SUBSELECTED) {
li.addClass('mm-selected');
}
});
// $('#menu').metisMenu('dispose');
// $("#menu").metisMenu();
$('.metismenu a').not('.has-arrow').on('click', loadPage);
}
function loadPage(e) {
e.preventDefault();
if($(this).parent().hasClass('mm-selected')) return;
var selected=$(this);
alert(selected);
}
$(function(){
composeMenu(tabMenu);
$("#menu").metisMenu();
}); |
@Ices-Eyes |
Hi, made sme try, and the problem seems to reside on the dispose method before creating the menu. Removed the dispose and all is working now... Not sure why this was happening now and not on the previous version. |
it Works ... 👍 |
I'm having the same problem. Is this related to jQuery? |
I solved the problem using setTimeout. The problem is related to a TranstionEnd event that calls some metis function after it has been disposed. |
Hi, since the 3.0.4 version, once I click on a menu I got this error:
It was all working fine with previous release. Looking at the code, I got that at lines
the property this.config is null, hence the error...
What I'm doing wrong?
The text was updated successfully, but these errors were encountered: