This is a migrated thread and some comments may be shown as answers.

Scheduler Custom TimelineView with overlapping events

1 Answer 178 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Ocean Software
Top achievements
Rank 1
Ocean Software asked on 27 Mar 2017, 11:47 PM

I'm trying to extend TimelineView so that some events overlap and others are bumped to the next line depending on their status. I can overwrite the _arrangeRows method but can't get the collidingEvents to overwrite. How do I overwrite collidingEvents from the TimelineView?

<script type="text/javascript">

    var customTimelineView = kendo.ui.TimelineView.extend({
        options: {
            name: "customTimelineView",
            title: "Custom Time Line",
            columnWidth: 30,
        },
        name: "customTimelineView",

        _arrangeRows: function (eventObject, slotRange, eventGroup) {
            var test = "test";
            var startIndex = slotRange.start.index;
            var endIndex = slotRange.end.index;
            var rect = eventObject.slotRange.innerRect(eventObject.start, eventObject.end, false);
            var rectRight = rect.right + this.options.eventMinWidth;
            //var events = kendo.ui.SchedulerView.collidingEvents(slotRange.events(), rect.left, rectRight);
            var events = collidingEvents(slotRange.events(), rect.left, rectRight);
            slotRange.addEvent({
                slotIndex: startIndex,
                start: startIndex,
                end: endIndex,
                rectLeft: rect.left,
                rectRight: rectRight,
                element: eventObject.element,
                uid: eventObject.uid
            });
            events.push({
                start: startIndex,
                end: endIndex,
                uid: eventObject.uid
            });
            var rows = kendo.ui.SchedulerView.createRows(events);
            if (eventGroup.maxRowCount < rows.length) {
                eventGroup.maxRowCount = rows.length;
            }
            for (var idx = 0, length = rows.length; idx < length; idx++) {
                var rowEvents = rows[idx].events;
                for (var j = 0, eventLength = rowEvents.length; j < eventLength; j++) {
                    eventGroup.events[rowEvents[j].uid].rowIndex = idx;
                }
            }
        },

    });

    function collidingEvents(elements, left, right) {
        var idx, startPosition, overlaps, endPosition;
        for (idx = elements.length - 1; idx >= 0; idx--) {
            startPosition = elements[idx].rectLeft;
            endPosition = elements[idx].rectRight;
            overlaps = startPosition <= left && endPosition >= left;
            if (overlaps || startPosition >= left && endPosition <= right || left <= startPosition && right >= startPosition) {
                if (startPosition < left) {
                    left = startPosition;
                }
                if (endPosition > right) {
                    right = endPosition;
                }
            }
        }
        return kendo.ui.SchedulerView.eventsForSlot(elements, left, right);
    }

</script>

 

Also, why are some of the functions prefixed with "_"? ie What is difference between "render()" and "_render()"?

 

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 29 Mar 2017, 01:08 PM
Hello,

I am afraid assistance on extending widgets and guidance on modifying source code falls outside the scope of the Support Service. Our Professional Services team specializes in customizations not achievable through widget configuration or using the exposed API methods, according to specific client requirements. The Support Service provides guidance and explanation for built-in features of the products. Feel free to ask if you have questions on a specific built-in feature or behavior.  

Regards,
Ivan Danchev
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Scheduler
Asked by
Ocean Software
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or