jQuery UI Widgets Forums Grid Multiple Contextmenu on jqxGrid

This topic contains 1 reply, has 2 voices, and was last updated by  Dimitar 10 years, 4 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Multiple Contextmenu on jqxGrid #48980

    Chris Roh
    Participant

    Hi.
    I had multiple context menu by different column on jqxGrid.
    In my testing, these context menus was shown, but one was worked well and the other was not worked.
    This code.

    //context menu
    var contextMenu = $(“#jqxMenu_gridMenu”).jqxMenu({ width: 150, height: ‘auto’, autoOpenPopup: false, mode: ‘popup’});
    var contextMenuPerson = $(“#jqxmenu_gridMenuPerson”).jqxMenu({ width: 150, height: ‘auto’, autoOpenPopup: false, mode: ‘popup’});

    $(“#jqxGrid_grid”).on(‘contextmenu’, function(){ return false; });

    $(“#jqxMenu_gridMenu”).on(‘itemclick’, function(event) {
    var args = event.args;
    var gridItem = $.trim($(args).text());

    switch (gridItem){
    case ‘menu1’:
    alert(‘Check Menu1’)
    break;
    case ‘menu2’:
    alert(‘Check Menu2’);
    break;
    case ‘menu3’:
    alert(‘Check Menu3’);
    break;
    }
    });

    $(“#jqxMenu_gridMenuPerson”).on(‘itemclick’, function(event) {
    var args = event.args;
    console.log(args)
    var gridItem = $.trim($(args1).text());

    switch (gridItem){
    case ‘menu01’:
    alert(‘Check Menu01’);
    break;
    case ‘menu02’:
    alert(‘Check Menu02’);
    break;
    case ‘menu03’:
    alert(‘Check Menu03’);
    break;
    }
    });

    //right-click in jqxGrid
    $(“#jqxGrid_grid”).on(‘cellclick’, function(event) {
    if (event.args.rightclick) {
    var columnheader = $(“#jqxGrid_grid”).jqxGrid(‘getcolumn’, event.args.datafield);
    var scrollTop = $(window).scrollTop();
    var scrollLeft = $(window).scrollLeft();

    if ( columnheader.datafield == ‘toPerson’) {
    contextMenuPerson.jqxMenu(‘open’, parseInt(event.args.originalEvent.clientX) + 5 + scrollLeft, parseInt(event.args.originalEvent.clientY) + 5 + scrollTop);
    } else {
    contextMenu.jqxMenu(‘open’, parseInt(event.args.originalEvent.clientX) + 5 + scrollLeft, parseInt(event.args.originalEvent.clientY) + 5 + scrollTop);
    }
    return false;
    }
    });

    Regard,
    Chris Roh

    • This topic was modified 10 years, 4 months ago by  Chris Roh.
    Multiple Contextmenu on jqxGrid #49066

    Dimitar
    Participant

    Hello Chris Roh,

    Please provide us with a complete example, including your HTML code. It is possible that the issue originates there. Remember to format your code before posting by selecting it and clicking on the code button in the toolbar.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.