Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get the range/innerHtml of an item when item is drag to timeline vis.js? #269

Open
SIMHACHALAM1001 opened this issue May 7, 2017 · 0 comments

Comments

@SIMHACHALAM1001
Copy link

SIMHACHALAM1001 commented May 7, 2017

1.I have an items in one div

2.I am dragging that items and dropping in the timeline.

3.so At the time of dropping.I want to get the timeline range of that particular item.

  1. I used ng-draggable,timeline vis.js libraries.

Items in one div code :

<div class="timeline-elements-left-column">
                <md-card class="timeline-elements-container"
                             ng-repeat="element in vm.elementAndStages">
                    <md-toolbar md-scroll-shrink class="timeline-selected-elements drag-object">
                        <div layout="row"
                             id="translation-icon-move"
                             ng-drag="vm.isDragging"
                             ng-mousedown="vm.StartDragging(element, event)"
                             ng-drag-data="element">
                            <div flex class="timeline-selected-elements-text">
                                <span>{{element.selectedElement.description}}</span>
                            </div>
                            <div class="timeline-selected-elements-icon">
                                <md-icon ng-show="element.selectedElement.collapsed"
                                         class="zmdi zmdi-chevron-up"
                                         ng-click="vm.Collapse(element.selectedElement)">
                                </md-icon>
                                <md-icon ng-hide="element.selectedElement.collapsed"
                                         class="zmdi zmdi-chevron-down"
                                         ng-click="vm.Collapse(element.selectedElement)">
                                </md-icon>
                            </div>
                            <div class="timeline-selected-elements-icon timeline-selected-elements-icon-drag">
                                <md-icon class="zmdi zmdi-more-vert"></md-icon>
                            </div>
                        </div>
                    </md-toolbar>
                </md-card>
            </div>

4.So here vm.StartDragging() is the function to Drag the event.

  1. so at the time of start Dragging function

    function StartDragging(data:stage,event :any){

    console.log(this.timeline.getEventProperties(event));
    }

so at the time of dragging its working fine.

  1. Problem is at drop-success.

  2. Dropping success on timeline but I am unable to get that range where user is dropping the item in timeline.

  3. Dropping code in Html

    <div class="vis-group" ng-drop="true" ng-drop-success="vm.OnDropComplete($index, $data, $event,0)" ng-drag-stop="vm.StopDragging($event)" id="group0" style="height: 173px;">
    
  4. Here Dropping is fine.

5.OnDropComplete function code

OnDropComplete(index :number,stage:any,event: any, groupId: number): void {

    var indexToRemove: number = -1;
    this.pendingChanges = [];

console.log(this.timeline.getEventProperties(event));
}

  1. so console.log(this.timeline.getEventProperties(event)); this line generating error.Here Event is ok , but event.target is undefined.

enter image description here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant