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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Custom context menu

Thread ID:

Created:

Updated:

Platform:

Replies:

119505 Jul 1,2015 01:39 PM UTC Jul 28,2015 04:16 PM UTC JavaScript 7
loading
Tags: ejTreeGrid
Niko Autio
Asked On July 1, 2015 01:39 PM UTC

Hi

I have some problems with context menu of tree grid. 

1. Shortly: Custom elements aren't working
    a. Icon of custom element goes over first context menu element (see picture)
    b. Custom element is not hoovered if cursor is on it, only default elements work (in screenshot cursor is not visible but its actually on Delete 2 element). 
    c. Click event is not received

2: You demo shows that nested context menus are supported but how do I can do one? Debug information of event args is not usefull and no documentation eather.

3: I use 13.1.0.21 but screenshot is from 13.1.0.30. As you can see sub context menu is not visible, but it appears after adding one row. Like I say this is only 13.1.0.30 related.

Simplified code is attached (context menu related code is still basicly just copy paste from documentation).

Attachment: contextmenu_a7955063.zip

Mahalakshmi Karthikeyan [Syncfusion]
Replied On July 2, 2015 12:54 PM UTC

Hi Niko,


Sorry for the inconvenience caused.


Query 1: 1. Shortly: Custom elements aren't working

    a. Icon of custom element goes over first context menu element (see picture)

    b. Custom element is not hoovered if cursor is on it, only default elements work (in screenshot cursor is not visible but its actually on Delete 2 element). 

    c. Click event is not received

Solution: For your kind information, it is mandatory to provide a value without a space , for the ‘menuId’ property  in the contextMenuItems object. Please refer the below code snippet to add a custom menu item in TreeGrid.


$(function() {

    $("#TreeGridContainer").ejTreeGrid({

        //...

        contextMenuOpen: oncontextmenu

    });


    function customMenuClick(args) {

        alert("custom menu event trigggered");

    }


    function oncontextmenu(args) {

        args.contextMenuItems.push({

            headerText: "Delete 2",

            menuId: "Delete2",

            iconPath: "url(folder-open.png)",

            eventHandler: customMenuClick

        })

    }

});



Query 2: 2: You demo shows that nested context menus are supported but how do I can do one? Debug information of event args is not usefull and no documentation eather.

Solution: We can add a sub context menu with the help of innerContextMenuItems in the event argument of contextMenuOpen. Please refer the below code snippet to add a sub context menu to the existing menu item.


$(function() {

    $("#TreeGridContainer").ejTreeGrid({

        //...

        contextMenuOpen: oncontextmenu

    });

    function oncontextmenu(args) {

        args.innerContextMenuItems.push({

            headerText: "Inner Menu",

            menuId: "InnerMenu"

        })

    }

});



Is this not your requirement, please get back to us with more information.


Query 3: 3: I use 13.1.0.21 but screenshot is from 13.1.0.30. As you can see sub context menu is not visible, but it appears after adding one row. Like I say this is only 13.1.0.30 related.

Solution: Sub context items when adding a new row is based on the selected row, which contains above and below option to add a new row. But if the DataSource is empty we won’t get these items because we can not specify a position for new row to insert , and when a row is added ,now there are two possibilities to add above or below to the existing row , and hence a sub context menu appears in this case.



We have also prepared a sample based on this and you can find the sample under the following location.

Sample: http://www.syncfusion.com/downloads/support/forum/119505/ze/ContextMenuId477560876


Please let us know if you need more information on this.


Regards,

Mahalakshmi K.  


Niko Autio
Replied On July 3, 2015 11:27 AM UTC

Thanks for your reply.

I think that there is no single word about menuId in your documentation, it propably should be fixed. Also I want mention that after testing this feature in sandbox I implemented it to my software and callbacks stopped working, I think pretty long time that problem was in my architecture because context menu was working visuually ok. But after some time wasting I noticed that reason was that my id was only numerical ("0", "1", "2"...) and after adding some stuff between that callback started working, if this is by design i hope that you document that as well.

But about subcontext menus... I don't find any references or id's which link innercontextmenu elements to root level context menu. Is "innercontextmenu" just hard coded to be sub menu of first root element? So is it possible to do submenus for more than one root element? And is it possible to do more than 2 levels context menus? And how about templates, like if want do something like your column chooser? Current functionality is enought for now but just asking for the future since I believe at some point those might be handy (so general answer is enought, workaround samples not needed).

Mahalakshmi Karthikeyan [Syncfusion]
Replied On July 6, 2015 12:20 PM UTC

Hi Niko,

Sorry about the inconvenience caused.


Query 1: I think that there is no single word about menuId in your documentation, it probably should be fixed.

Solution: For your kind information, we have already logged a documentation task regarding this modifications and we are working on this currently , the documentation will be refreshed soon. A support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

 

Query 2: But after some time wasting I noticed that reason was that my id was only numerical ("0", "1", "2"...)

Solution: currently Treegrid supports only string values as “menuId”. so we have also logged an issue report to to support numeric values as menuId. A support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents


Query 3: So is it possible to do submenus for more than one root element? And is it possible to do more than 2 levels context menus? And how about templates,

Solution: At present “innerContextMenuItems” is supported only for ‘Add’ option alone .And So we have logged a feature report on “support for submenus and template concept for Contextmenu” regarding this requirement. A support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

Please let us know if you need further assistance on this.

Regards,

Mahalakshmi K.


krishna
Replied On July 24, 2015 09:17 AM UTC

Hello Guys

I want to add the row with above and below options in context-menu but event handler for sub-menu items (above and below) is NULL
so to resolve that issue I have created custom context menu items with event handler functionality but it will not work for sub-menu items (like for above and below) mns on first level it works fine but for 2nd level doesn't work, why???????????????????????  

Mahalakshmi Karthikeyan [Syncfusion]
Replied On July 27, 2015 11:43 AM UTC

Hi Krishna,

Sorry about the inconvenience caused.

Currently there is no support for event handlers to sub-context menu item in TreeGrid control. We have already logged feature report regarding this. A support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

Please let us know if you require further assistance on this.      

Regards,

Mahalakshmi K.


Niko Autio
Replied On July 27, 2015 11:51 AM UTC

FYI

I am already replaced tree grid custom menu with general purpose context menu so I don't need it personally anymore.

Mahalakshmi Karthikeyan [Syncfusion]
Replied On July 28, 2015 04:16 PM UTC

Hi Niko,

Sorry about the inconvenience caused.

Though the feature itself being valuable we have not yet planned to implement it, so as said in our previous update this will be implemented in any of our upcoming main release . We will let you know once this feature has been implemented.

Regards,

Mahalakshmi K.


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.

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

;