jQuery UI Widgets › Forums › Scheduler › Context Menu
Tagged: calendar, event, event calendar, javascript scheduler, jquery scheduler, jqwidgets scheduler, Outlook Style Calendar, scheduler
This topic contains 7 replies, has 2 voices, and was last updated by Peter Stoev 8 years, 8 months ago.
-
AuthorContext Menu Posts
-
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.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 StoevjQWidgets Team
http://www.jqwidgets.comThanks 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.
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.comThanks 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.Hi jacky,
Well it was just a suggestion. You can also select a cell using the Scheduler’s selectCell method.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHI 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
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 -
AuthorPosts
You must be logged in to reply to this topic.