We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

how I add a menu in the grid toolbar

Thread ID:

Created:

Updated:

Platform:

Replies:

149327 Nov 21,2019 09:34 PM UTC Nov 22,2019 01:10 PM UTC ASP.NET MVC - EJ 2 1
loading
Tags: Grid
Ricardo
Asked On November 21, 2019 09:34 PM UTC

I would like to add a menu in the toolbar which is in the grid but it doesn´t work, thanks for the help

Attachment: toolbar_grid_284a8cc2.zip

Thavasianand Sankaranarayanan [Syncfusion]
Replied On November 22, 2019 01:10 PM UTC

Hi Ricardo,  

Greetings from Syncfusion support 

We suggest you to follow the below steps. Here we have used the created event to render the Menu in grid toolbar. Please follow the code snippet and sample for more reference. 

Index.cshtml 

@{ 
    List<object> toolbarItems = new List<object>(); 
    toolbarItems.Add(new { text = "Menu", template = "#menuitem" }); 
} 
 
<div id="menuitem">                                                               // div element is created 
    <ul class="menu" id="tool_menu"></ul> 
</div> 
 
 
@Html.EJS().Grid("grid").DataSource((IEnumerable<object>)ViewBag.DataSource). 
ShowColumnChooser(true).AllowPaging(true). 
        …  
}).Created("created").Toolbar(toolbarItems).AllowPaging().Render() 
<script> 
 
    function created() { 
        var menuItems = [ 
            { 
                text: 'Items', 
                iconCss: 'e-icons MT_menu1', 
                items: [ 
                    { text: 'Item 1' },                           // items in the Menu  
                    { text: 'Item 2' }, 
                    { text: 'Item 3' }, 
                ] 
            } 
        ]; 
 
        var menuObj = new ej.navigations.Menu({ items: menuItems, select: onMenuSelect });  //Menu is created 
        menuObj.appendTo("#tool_menu");                                         // Menu is append to created div element 
    } 
    function onMenuSelect(args) { 
        // Triggers on selecting menu item 
    } 
</script> 
 



Please get back to us if you need further assistance 

Regards 
Thavasianand S. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon