Skip to content

Loading…

Sub Menus not getting displayed correctly #56

Closed
AnirbanKundu opened this Issue · 4 comments

2 participants

@AnirbanKundu

Hi Rod,

I am using jquery context menu with kendo grid. Whenever the user clicks on the different headers of the grid, the context menu should open up based on the column name - i.e. the context menu items should be populated dynamically.

I have used to create the context menus based on http://medialize.github.com/jQuery-contextMenu/demo/dynamic-create.html

But I see the sub-menu options are not being correctly displayed. The sub-menu is getting displayed not at the position where the parent menu is opening. Please refer to the fiddle I have created : http://jsfiddle.net/anirbankundu/pR6nq/2/

If you do a right click on column Header = "colA", you will see a context menu with sub menus.But the sub-menu option is not opening at a position relative to its parent menu. If you click column Header ="colB", you will see a different context menu.

Could you please let me know why the sub-menus are not getting displayed correctly.

Thanks,
Anirban

@AnirbanKundu

I have created a simple fiddle to show that this behavior is uniform for any other control used not for the grid used:
http://jsfiddle.net/anirbankundu/8TL3c/

Code I have used is :

$(document).ready(function () {

$.contextMenu({
  selector: ".foo",
  build: function($trigger) {
    var options = {
      callback: function(key, options) {
        var m = "clicked: " + key;
        window.console && console.log(m) || alert(m);
      },
      items: {}
    };

    if ($trigger.hasClass('something')) {
      options.items.foo = {name: "foo"};
    } else {
      options.items.bar = {"name": "Other group",
                                "items": {
                                    "fold1a-key1": { "name": "echo" },
                                    "fold1a-key2": { "name": "foxtrot" },
                                    "fold1a-key3": { "name": "golf" }
                                }};
    }

    return options;
  }
});

});

@rodneyrehm

If you add the jQuery UI position plugin to your fiddle, everything works fine. I'll look into what's wrong with the fallback positioning shortly

@rodneyrehm

I've fixed the positioning for missing $.ui.position. Fix is in release 1.5.19.

@rodneyrehm rodneyrehm closed this
@AnirbanKundu

Thanks Rod.

Regards,
Anirban

@baohx2000 baohx2000 pushed a commit to Contatta/jQuery-contextMenu that referenced this issue
@rodneyrehm rodneyrehm position sub-menu relative to container - Issue #56 9e86ea5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.