search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

getting the column id via context menu javascript

Asked by anwar
10 years ago.

hi im trying to use the context menu to open a popup to create a new event
i can get the date but cannot get the resource id or column id to populate
below is the code im using

<DayPilot:MenuItem Action="JavaScript" Text ="New" JavaScript="'PopupNew.aspx?start=' + e.start(e) + '&end=' + e.end(e) + '&column=id', 'PopupDetail', 'width=400,Height=450,top=200,left=200');" />

Answer posted by Dan Letecky [DayPilot]
10 years ago.

Here is an example of a context menu used for time range selection:

    <DayPilot:DayPilotMenu ID="DayPilotMenuSelection" runat="server" CssClassPrefix="menu_default">
        <DayPilot:MenuItem Action="JavaScript" JavaScript="dpc1.timeRangeSelectedCallBack(e.start, e.end, e.resource); dpc1.clearSelection();"
            Text="Create new event (JavaScript)" />
        <DayPilot:MenuItem Action="PostBack" Command="Insert" Text="Create new event (PostBack)" />
        <DayPilot:MenuItem Action="CallBack" Command="Insert" Text="Create new event (CallBack)" />
        <DayPilot:MenuItem Text="-" ></DayPilot:MenuItem>
        <DayPilot:MenuItem Action="JavaScript" JavaScript="if (!copied) { alert('You need to copy an event first.'); return; } dpc1.commandCallBack('paste', {id:copied, start: e.start});" Text="Paste" />
        <DayPilot:MenuItem Text="-" ></DayPilot:MenuItem>
        <DayPilot:MenuItem Action="JavaScript" JavaScript="alert('Start: ' + e.start.toString() + '\nEnd: ' + e.end.toString() + '\nResource id: ' + e.resource);"
            Text="Show selection details" />
        <DayPilot:MenuItem Action="JavaScript" JavaScript="dpc1.clearSelection();"
            Text="Clean selection" />

You can access the selection properties using e.start, e.end and e.resource.

See also:

Comment posted by anwar
10 years ago.

i have tried e.resource without brackets i get undefined and with the brackets i get nothing populating
i get the date ranges populating and also if i use it over a current entry the current entry id

Comment posted by anwar
10 years ago.

im getting this java error

SCRIPT438: Object doesn't support property or method 'resource'

when i do a javascript debug

i get stuck on the method below
function onclick()
var e = this.parentNode.event || this.parentNode.selection; var command = ''; openPopup(e.start(e), e.end(e), e.resource(e));; return false;

Answer posted by anwar
10 years ago.

its fine i managed to use postscript method e.command to populate the javascript from behind code and use e.resource

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.