Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Tom on Nov 06, 2009 10:27
open dhtmlx forum
DHTMLx scheduler - units view

Is there an easy way to determine the units column which corresponds to an arbitrary x,y coordinate.

For example, for the day\week\month views you can use the following to return the equivalent start date on the calendar for a native event object:

var pos = dhtmlXScheduler._mouse_coords(e);
var start = dhtmlXScheduler._correct_shift(dhtmlXScheduler._min_date.valueOf() + (pos.y * dhtmlXScheduler.config.time_step + (dhtmlXScheduler._table_view ? 0 : pos.x) * 24 * 60) * 60000);

Answer posted by Stanislav (support) on Nov 09, 2009 05:41
Before including the dhtmlxscheduler_units.js , add the next line
<script>
   scheduler.__mouse_coords = scheduler._mouse_coords;
</script>

After that you will be able to use 

var unit = scheduler._props[scheduler._mode].options[scheduler.__mouse_coords(e).x].key;