I am using the mmenu plugin found here http://mmenu.frebsite.nl/. It works with a pre-defined list.
I am using for a contact list where users change state regularly. I have tried the below function to update the list dynamically but the mmenu plugin seems to be no longer working with the newly added items.
is there a way to make it update?
function updateChatContacts() {
$(".contacts-list-chat").empty();
for (var key in contacts) {
var state;
if(contacts[key].state === 'DND')
state = 'busy';
else if(contacts[key].state === 'page-me')
state = 'away';
else
state = contacts[key].state;
var elem = '<li class="img no-arrow">'+
'<span>'+
'<i class="'+state+'"></i>'+
'<img src="assets/img/avatars/avatar2.png" alt="avatar 2"/>'+
'<div class="chat-name">'+key+'</div>'+
'<div>'+state.charAt(0).toUpperCase() + state.slice(1)+'</div>'+
'</span>'+
'<ul class="chat-messages">'+
'<div class="chat-input">'+
'<input type="text" class="form-control send-message" placeholder="Type your message" />'+
'</div>'+
'</ul>'+
'</li>';
//if (markers[key].selected === true) {
$(".contacts-list-chat").append(elem);
}
}