jQuery UI Widgets Forums Scheduler Context Menu

This topic contains 7 replies, has 2 voices, and was last updated by  Peter Stoev 8 years, 8 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Context Menu Posts
  • Context Menu #80617

    Jacky
    Participant

    Hi Peter:
    I confused by the context menu, the contextMenuItemClick event has 3 params, menu, appointment, event. But I want to get the cell clicked.
    Can you help me?
    Thanks very much.

    Context Menu #80618

    Peter Stoev
    Keymaster

    Hi Jacky,

    The cell is selected when you open the menu, so you can get it through the Scheduler’s getSelection method.

    Hope this helps.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Context Menu #80652

    Jacky
    Participant

    Thanks Peter, but it works only at the first time. For example, cell a and cell b, the first time i right click cell a, the contextmenu open, and the cell a is selected, but when i right click cell b, the selected cell is still cell a. How can the selected cell change to b.

    Context Menu #80662

    Peter Stoev
    Keymaster

    Hi jacky,

    Selection is changed only with left mouse click or keyboard. On right click, the cell is selected only the first time because there is no active selection. So you can use the Scheduler’s clearSelection to clear the selection after opening the scheduler’s context menu and next time the cell will be selected again.

    Best Regards,
    Peter Stoev
    jQWidgets Team
    http://www.jqwidgets.com

    Context Menu #80722

    Jacky
    Participant

    Thanks for you reply.
    But your method didn’t work still.
    My code is:
    contextMenuItemClick: function (menu, appointment, event)
    {
    var args = event.args;
    var selection = $(‘#scheduler’).jqxScheduler(‘getSelection’);
    alert(selection);
    var id = args.id;
    if(id == “del”){
    deleteProcess(appointment);
    }
    if(id == “upd”){
    updateProcess(appointment);
    }
    if(id == “add”){
    addProcess();
    }
    },
    contextMenuOpen: function (menu, appointment, event) {
    $(‘#scheduler’).jqxScheduler(‘clearSelection’)
    var selection = $(‘#scheduler’).jqxScheduler(‘getSelection’);
    alert(selection);
    if (!appointment) {
    menu.jqxMenu(‘hideItem’, ‘del’);
    menu.jqxMenu(‘hideItem’, ‘upd’);
    menu.jqxMenu(‘showItem’, ‘add’);
    }
    else {
    menu.jqxMenu(‘showItem’, ‘del’);
    menu.jqxMenu(‘showItem’, ‘upd’);
    menu.jqxMenu(‘hideItem’, ‘add’);
    }
    },
    in contextMenuOpen event. I clear the selection. But in contextMenuItemClick getSelection is null.

    Context Menu #80731

    Peter Stoev
    Keymaster

    Hi jacky,

    Well it was just a suggestion. You can also select a cell using the Scheduler’s selectCell method.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Context Menu #80821

    Jacky
    Participant

    HI Peter:
    I have tried the selectCell method. This method need 3 paramaters, the first one is date, now return to the first question, I can’t get the cell, so I don’t know the date.
    I suggest that when the contextmenu opened, the cell can be passed to the open method.

    Best Regards

    Context Menu #80824

    Peter Stoev
    Keymaster

    Hi jacky,

    We do not see a reason to pass it. The scheduler works with selected cells and selected appointments. Both can be retrieved through the api. The context menu opens a dialog which works only with selections and fills its fields depending on what is selected.

    Regards,
    Peter

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

You must be logged in to reply to this topic.