EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: tmark on September 24, 2012, 09:44:50 AM



Title: dynamically created splitbutton and subitems
Post by: tmark on September 24, 2012, 09:44:50 AM
How can I create dynamically splitbuttons?

From the doc.:
<a href="javascript:void(0)" id="sb" onclick="javascript:alert('ok')>Ok</a> 
<div id="mm" style="width:100px;"> 
... 
</div>

$('#sb').splitbutton({ 
    iconCls: 'icon-ok', 
    menu: '#mm' 
});

Ok, and how can I insert new items (id, title, icon) in the menu part of #sb?

Thanks, Mark


Title: Re: dynamically created splitbutton and subitems
Post by: anton.dutov on September 24, 2012, 06:34:00 PM
Something like that
Code:
$('#mm').menu('appendItem', {
text: 'New Item',
iconCls: 'icon-ok',
onclick: function(){alert('New Item')}
});


Title: Re: dynamically created splitbutton and subitems
Post by: tmark on September 25, 2012, 01:20:20 AM
Unfortunatelly it does not work for me.
It generates a new menu item, but not in the menulist, it will be a menuheader. :(


Thanks, it works!

Mark