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

Schedule Drag and Resize do not update the event data #2070

Closed
wonbyte opened this issue Feb 14, 2017 · 3 comments
Closed

Schedule Drag and Resize do not update the event data #2070

wonbyte opened this issue Feb 14, 2017 · 3 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@wonbyte
Copy link

wonbyte commented Feb 14, 2017

I'm submitting a ... (check one with "x")

[x ] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Current behavior

If you go to http://www.primefaces.org/primeng/#/schedule and drag a few of the existing events to a new time slot. Then change the start date of any of the events and all the moved events will revert to their previous location.

Expected behavior

An event should not move location due to interaction with another event.

Minimal reproduction of the problem with instructions

Can be reproduced on http://www.primefaces.org/primeng/#/schedule

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

  • Angular version: 2.0.X
  • PrimeNG version: 2.0.X
  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

all

  • Language: [all | TypeScript X.X | ES6/7 | ES5]

  • Node (for AoT issues): node --version =

@wonbyte wonbyte changed the title Deleting a schedule event causes events to reshuffle Changing Event start date causes events to revert Feb 14, 2017
@wonbyte wonbyte changed the title Changing Event start date causes events to revert Changing Event start date causes moved events to revert to previous date Feb 14, 2017
@cagataycivici cagataycivici self-assigned this Feb 23, 2017
@cagataycivici cagataycivici added the Status: Pending Review Issue or pull request is being reviewed by Core Team label Feb 23, 2017
@cagataycivici cagataycivici added this to the 2.0.2 milestone Feb 23, 2017
@cagataycivici
Copy link
Member

This seems to be expected as Schedule gets the event array from the angular component and creates a separate internal array of its own with new properties that wrap the event object you've provided. Dragging and Resizing change the start and end dates of this internal event object, not the wrapped object you've provided. Also a callback is provided for you to do changes to the actual event object in events array. If you think, p-schedule component should update the events array which sounds like the angular way, following fixes the issue which gets the actual event and updates start and end dates.

What do you think?

eventDrop: (event, delta, revertFunc, jsEvent, ui, view) => {
                let sourceEvent = this.findEvent(event.id);
                if(sourceEvent) {
                    sourceEvent.start = event.start.format();
                    sourceEvent.end = event.end.format();
                }
                
                this.onEventDrop.emit({
                    'event': event,
                    'delta': delta,
                    'revertFunc': revertFunc,
                    'jsEvent': jsEvent,
                    'view': view
                });
            },

@cagataycivici cagataycivici added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Pending Review Issue or pull request is being reviewed by Core Team labels Feb 28, 2017
@cagataycivici cagataycivici changed the title Changing Event start date causes moved events to revert to previous date Schedule Drag and Resize do not update the event data Feb 28, 2017
@wonbyte
Copy link
Author

wonbyte commented Feb 28, 2017

@cagataycivici this fix will go with the 2.0.2 release correct? This is how I envision the behavior to work. I would also need to have the onDrop method in the component to correctly update the component event object correct?

@cagataycivici
Copy link
Member

2.0.2 yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

2 participants