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

Create validation on node drop #273

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Commits on Sep 21, 2017

  1. Create validation on node drop

    If a backend service return an rejected promise, node should not be moved.
    
    Example of usage from an agular directive:
    
     oc.$chart
                            .on('validate.nodedropped.orgchart', event => {
                                let defer = $q.defer();
                                CustomerHierarchyService
                                    .moveSection(event.draggedNode[0].id, event.dropZone[0].id)
                                    .then(() => {
                                        Message.showSuccess("Section was successfully moved!");
                                        defer.resolve();
                                    })
                                    .catch((error) => {
                                        Message.showError(error.data.responseStatus.message);
                                        defer.reject();
                                    });
    
                                return defer.promise;
                            })
                            .on('click','.node', function () {
                                var $this = $(this);
                                $('#selected-node').val($this.find('.title').text()).data('node', $this);
                            })
                            .on('dblclick','.node', function () {
                                editNode($(this));
                            })
                            .on('click', '.orgchart', event => {
                                if (!$(event.target).closest('.node').length) {
                                    $('#selected-node').val('');
                                }
                            });
    Martin Stangeby Lunde committed Sep 21, 2017
    Configuration menu
    Copy the full SHA
    9f34dce View commit details
    Browse the repository at this point in the history