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

how to use modal.js to open a add event dialog in daypilot scheduler lite

Asked by siaw
8 years ago.

i manage to show the scheduler bind with data from my database. But when i click on the free time slot it doesnt show a modal dialog for adding new event. i already include the modal.js in the js folder.

THIS is my javascript code:

<%@ Register assembly="DayPilot" namespace="DayPilot.Web.Ui" tagprefix="DayPilot" %>
<script type="text/javascript" src="js/modal.js"></script>
<script type="text/javascript">
function createEvent(start, end, resource) {
var modal = new DayPilot.Modal();
modal.top = 60;
modal.width = 300;
modal.opacity = 70;
modal.border = "10px solid #d0d0d0";
modal.closed = function () {
if (this.result == "OK") {
dp.commandCallBack('refresh');
}
dp.clearSelection();
};
modal.height = 500;
modal.showUrl("AddReservation.aspx?start=" + start.toStringSortable() + "&end=" + end.toStringSortable() + "&r=" + resource);
}

</script>

THIS is my aspx code:

<DayPilot:DayPilotScheduler ID="DayPilotScheduler1"
runat="server"
DataStartField="checkInDate"
DataEndField="checkOutDate"
DataTextField="reservationStatus"
DataValueField="reservationId"
DataResourceField="roomId"
DataTagFields="reservationStatus"
CellGroupBy="Month"
Scale="Day"
ClientObjectName="dps"
CellDuration="1440" RowHeaderWidth="100" CellWidth="80" style="top: 0px; left: 0px"

TimeRangeSelectedHandling="JavaScript"
TimeRangeSelectedJavaScript="createEvent(start, end, column);"
OnCommand="DayPilotScheduler1_Command">

</DayPilot:DayPilotScheduler>

I have no idea why i doesnt show a modal dialog. PLEASE HELP

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

Some of the DayPilotScheduler properties you are using are only available in the Pro version:

Scale
CellGroupBy
ClientObjectName
DataTagFields
OnCommand

Also, the TimeRangeSelectedJavaScript is resolved in a different way: The "start", "end", and "column" properties are not available. Instead, "{0}" is replaced by the start date/time in ISO format and "{1}" is replaced by the resource id. Example:

TimeRangeSelectedJavaScript="createEvent('{0}', '{1}');"


...



function createEvent(start, resource) {
 // ...
}
Comment posted by Siaw
8 years ago.

is there any tutorial for asp day pilot lite that i can refer?
because i refer to the tutorial in the website and most of them is for pro version..

Comment posted by Dan Letecky [DayPilot]
8 years ago.

The following tutorials use the Scheduler from the Lite version:

http://code.daypilot.org/16646/project-management-for-asp-net-open-source

http://code.daypilot.org/35296/open-source-gantt-chart-for-asp-net

The Lite version will get an update in the near future that will make the event handling API compatible with the Pro version.

Comment posted by SiaW
8 years ago.

but i need to use scheduler control not the gantt control.
is it both the same in implement?
and im confused with the tutorial that u posted, it using the createEvent(start, end, resource) to create a new event instead of what u say that day pilot lite need to use the createEvent(start, resource)

Comment posted by Anonymous
8 years ago.

the admin havent answer this question

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