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

TimeRangeDoubleClick not working

Asked by Anonymous
2 years ago.

https://api.daypilot.org/daypilot-scheduler-ontimerangedoubleclick/
https://api.daypilot.org/daypilot-scheduler-ontimerangedoubleclicked/

Double click does not fires any events, Please have look once and post a solution for that. I am using following code snippet for double click.

dp.onTimeRangeDoubleClicked = function(args) {
alert("DoubleClick: start: " + args.start + " end: " + args.end + " resource: " + args.resource);
};

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

Time range double click is disabled by default. You need to enable it first using timeRangeDoubleClickHandling property:

https://doc.daypilot.org/scheduler/time-range-double-click/

Let me know if it doesn't help.

Comment posted by Anonymous
2 years ago.

div id="container" >
<div id="content"> <div>
<div id="dp"></div>
<div id="print"></div>
<script type="text/javascript">
var empcount = 1;
var dp = new DayPilot.Calendar("dp");
dp.startDate = "2018-01-24"; // or just dp.startDate = "2013-03-25";
dp.days = 1;
dp.allDayEventHeight = 100;
dp.eventDoubleClickHandling = "Enabled";
dp.timeRangeDoubleClickHandling = "Enabled";
dp.moveBy = 'Full';
if(empcount > 9){
dp.columnWidthSpec = "Fixed";
dp.columnWidth = 150;
}
dp.cellDuration = 15;
dp.dayBeginsHour = 10;
dp.dayEndsHour = 19;
dp.cellHeight = 15;
dp.heightSpec = "Fixed";
dp.height = 470;

dp.viewType = "Resources";
dp.columns = [{"name":"san","id":"70"}];
dp.events.list = [];

//dp.bubble = new DayPilot.Bubble();
dp.bubble = null;
dp.contextMenu = new DayPilot.Menu({
cssClassPrefix: "menu_default",
items: [
{text:"Show event ID", onclick: function() {alert("Event value: " + this.source.value());} },
{text:"Show event text", onclick: function() {alert("Event text: " + this.source.text());} },
{text:"Show event start", onclick: function() {alert("Event start: " + this.source.start().toStringSortable());} },
{text:"Delete", onclick: function() { if(confirm("Do you really want to delete?")) {
console.log(this.source);
dp.events.remove(this.source);
dp.message("<span id='delete_msg'></span>");
} } }
]});

dp.onEventMoved = function (args) {
if(validateDate(args.e.data.start.value)){
moveBooking(args);
}
};

dp.onEventResized = function (args) {
dp.message("Resized: " + args.e.text());
};

dp.onTimeRangeDoubleClick= function(args) {
alert("DoubleClick: start: " + args.start + " end: " + args.end + " resource: " + args.resource);
};

dp.onEventDoubleClick = function(args) {
updatebooking(args.e.id());
};

dp.onBeforeEventRender = function(args) {
args.data.barColor = "red";
};

dp.init();

var e = new DayPilot.Event({
start: new DayPilot.Date("2013-03-25T12:00:00"),
end: new DayPilot.Date("2013-03-25T12:00:00").addHours(3),
id: DayPilot.guid(),
text: "Special event",
resource: "J"

});
dp.events.add(e);

</script>
</div>
</div>
</div>

I have enabled timeRangeDoubleClickHandling but its not working still.
Please suggest me what is wrong in this code?

Comment posted by laurent
2 years ago.

I can confirm, same behavior for me.

message: "topSelectedCell is not defined"
stack: "ReferenceError: topSelectedCell is not defined
eval at getSelection
DayPilot.Calendar.getSelection
DayPilot.Calendar._activateSelection
HTMLTableCellElement.c.ondblclick

Comment posted by laurent
2 years ago.

I added this work around to be able to use "time range doubleClick": (It works but don't know side effects)

Index: src/daypilot-calendar.src.js
<+>UTF-8
===================================================================

  • src/daypilot-calendar.src.js (date 1523518779000)

+++ src/daypilot-calendar.src.js (date 1523518779000)
@@ -5463,7 +5463,17 @@

c.ondblclick = function() {
DayPilotCalendar.firstMousePos = null;

+ // debugger;
+ // added to be able to use dblclick -- Begin
+ DayPilotCalendar.firstMousePos = calendar.coords;
+ DayPilotCalendar.firstMousePos.calendar = calendar;
+ calendar.clearSelection(); // initializes selectedCells if necessary
+ DayPilotCalendar.topSelectedCell = this;
+ DayPilotCalendar.bottomSelectedCell = this;
+ DayPilotCalendar.column = DayPilotCalendar.getColumn(this);
+ calendar.selectedCells.push(this);
+ DayPilotCalendar.firstSelected = this;
+ // added to be able to use dblclick -- Begin
calendar._activateSelection();
clearTimeout(DayPilotCalendar.selectedTimeout);

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