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

findByPixels returns cell with incorrect date

Asked by Ruud
2 years ago.


i have configured infinity scrolling, onIncludeTimeCell(days start at 12:00), and zoom levels.
Now i am using the onGridMouseDown event and i feed the args.originalEvent.x and y into findByPixels to know what cell was clicked. But the date from the cell that is returned is incorrect.
if i click on the cell from 15 jan 12:00 to 16 jan 12:00 it returns a cell with start: 2020-2-2T12 and end: 2020-2-3T12.
If i click on the cell from 15 march 12:00 to 16 march 12:00 it returns a cell with start: 2020-2-13T12 and end:2020-2-14T12.

if i click of the first cell that is shown(left top corner of the grid, second row) the timeline shows this as June15 12:00 to June 16 12:00 the cell returned by findByPixels returns start:2020-1-20T12 and end: 2020-1-21T12.

It seems findByPixels does not take the scrolling into account. Or is can't i use the onGridMouseDown args location with findByPixels.

If you need more information about my config please let me know.

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

And what's the use case?

The purpose of onGridMouseDown is to modify the click + shift/ctrl/meta behavior before the actual events are fired, not to handle clicks on events and cells.

Normally you wouldn't use this event at all. Instead, use onEventClick/onEventRightClick/onTimeRangeClick/onTimeRangeRightClick or active areas inserted into events/cells.

The cells.findByCells() method works with grid coordinates, not viewport coordinates. The current mouse coordinates (relative to the grid) are available using getCoords().

Comment posted by Ruud
2 years ago.

I was looking for a way to know what cell was clicked without it being selected. but i found a way of doing this with the onTimeRangeSelect and clearing the selection.

Thanks for the information

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