The Kendo context menu does not appear in the modal popup.

0 Answers 102 Views
Grid ModalView
Hemanshu
Top achievements
Rank 1
Hemanshu asked on 12 Dec 2023, 05:03 AM

Hello,


I'm using a model popup in which I bind the kendo grid and set the grid right-click to open the context menu. However, the context menu does not appear. I'm using Kendo 2023.2.606 version. Please leave your feedback.

This below same code work fine in normal page. But, it's not working in model popup.

Context menu Code is here:

<ul id="clientSearchGridContextMenu" class="hide">
    <li id="clientSearchGridContextMenuAddFavourite"><span class="menu-item k-link">@Resource.lblAddFavourite</span></li>
    <li id="clientSearchGridContextMenuRemoveFavourite" class="border-bottom-div"><span class="menu-item k-link">@Resource.lblRemoveFavourite</span></li>
    <li id="clientSearchGridContextMenuClose"><span class="menu-item k-link">@Resource.lblClose</span></li>
</ul>

 

JavaScript code for context men:

  bindClientSearchGridContextMenu: function (favourites) {
      clientManagement.variable.clientSearchGridContextMenuAddFavourite.css('display', favourites ? 'none' : 'block');
      clientManagement.variable.clientSearchGridContextMenuRemoveFavourite.css('display', favourites ? 'block' : 'none');

      clientManagement.variable.clientSearchGridContextMenu.kendoContextMenu({
          target: "#clientMatterGrid",
          filter: "tbody > tr",
          open: function (e) {
              clientManagement.variable.clientSearchGridContextMenu.addClass("show");
              let node = $(e.target);
              $("#clientMatterGrid").data('kendoGrid').select(node);
          },
          select: function (e) {
              let node = $(e.target);

              $("#clientMatterGrid").data('kendoGrid').select(node);

              switch ($(e.item).attr('id')) {
                  case "clientSearchGridContextMenuAddFavourite":
                      clientManagement.addRemoveFavourite(true);
                      break;
                  case "clientSearchGridContextMenuRemoveFavourite":
                      clientManagement.addRemoveFavourite(false);
                      break;
                  case "clientSearchGridContextMenuClose":
                      clientManagement.variable.clientSearchGridContextMenu.data("kendoContextMenu").close();
                      break;
              }
          }
      });
  }

 

Nikolay
Telerik team
commented on 14 Dec 2023, 12:12 PM

Hi

The built-in ContextMenu is available for the Grid as of the 2023 R3 release. 

I recommend upgrading to have it in your project.

Nevertheless, to have the custom ContextMenu working as expected I recommend initializing it after the popup has opened and the Grid has been initialized.

Regards,

Nikolay 

Hemanshu
Top achievements
Rank 1
commented on 14 Dec 2023, 12:47 PM | edited

Hi,

I have already tried with the latest version and it is not fixed in there. It's worked fine in normal page. But, not working in model popup.

 

Regards,

Hemanshu

Nikolay
Telerik team
commented on 19 Dec 2023, 08:29 AM

Hi Hemanshu,

I just tested the built-in Grid context menu inside a kendo UI Dialog and it is showing as expected:

Here is the Dojo demo I prepared: https://dojo.telerik.com/eQuMihoP

Could you please modify it to showcase the problem so I can investigate further?

Regards,

Nikolay

Hemanshu
Top achievements
Rank 1
commented on 19 Dec 2023, 09:34 AM

Hi,

I am using standard Bootstrap ones. The context menu is not working with the Bootstrap popup.

 

Regards,

Hemanshu

Hemanshu
Top achievements
Rank 1
commented on 20 Dec 2023, 10:24 AM

Hi,

I am using standard Bootstrap. The context menu is not working with the Bootstrap popup. Can you please provide your feedback on it?

 If you have any examples of the Contextmenu inside the Bootstrap popup please provide me.

Regards,

Hemanshu

Nikolay
Telerik team
commented on 22 Dec 2023, 08:49 AM

Hi Hemanshu,

Thank you for clarifying the case.

I created a sample Dojo demo where the Grid is initialized inside a Bootstrap modal and the Context Menu appears to be working as expected.

Dojo demo: https://dojo.telerik.com/onARAXIF

Could you please modify it to showcase the problem so I can investigate further?

Regards,

Nikolay

No answers yet. Maybe you can help?

Tags
Grid ModalView
Asked by
Hemanshu
Top achievements
Rank 1
Share this question
or