EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: jega on October 26, 2018, 02:03:23 AM



Title: [SOLVED] menuButton add items
Post by: jega on October 26, 2018, 02:03:23 AM
Hi

Need to add more items to a menu after loading the page.

<div id="menuList" class="easyui-panel menuBox" style="width:100%;padding:5px">
     <a id="pub" href="javascript:void(0)" class="easyui-menubutton" data-options="menu:'#menu_docs',iconCls:'icon-documents',plain:true">Documents</a>
</div>

<div id="menu_docs" class="easyui-menu">
     <div onclick="window.open('doc_default.pdf','_blank')">Default document</div>
</div>

Getting a filelist from server folder

$.each(filesData, function(index, element){
   var dataTag = '<div onclick="window.open('+element.filename+')"></div>';
   $('#menu_docs').append(dataTag);
});

But can't see it in the menu

Any help ??

Regards
Jesper


Title: Re: menuButton add items
Post by: stworthy on October 26, 2018, 06:55:09 PM
Please call 'appendItem' method to append menu items. Please refer to this documentation https://www.jeasyui.com/documentation/menu.php


Title: Re: menuButton add items
Post by: jega on October 27, 2018, 01:32:53 AM
Why didn't i see that.  :)

Thanks