Page 1 of 1

Change multiple tasks at once

Posted: Sun Jul 07, 2013 3:36 am
by glenh123
Hi

I know the Gantt control supports selecting multiple tasks at once. But does it support the changing of dates for all when selected.

i.e. If I select more than one task and then drag the right outwards to extend the date. It only performs this for the last task selected and not all of them. Likewise moving them rather than dragging them I would expect the same functionality (all to move).

Is there something I need to do to turn this on? Or do I need to write some custom code?

Thanks

Re: Change multiple tasks at once

Posted: Sun Jul 07, 2013 3:18 pm
by mats
This is not supported. We have a ticket open for allowing dragging of multiple tasks, for now you'll need some custom code to handle this.

Re: Change multiple tasks at once

Posted: Thu Jun 04, 2015 7:42 am
by glenh123
Hi

Has this function been implemented yet?

Thanks

Re: Change multiple tasks at once

Posted: Thu Jun 04, 2015 7:57 am
by arcady
No, unfortunately it's not yet. The ticket is still there.

Re: Change multiple tasks at once

Posted: Wed Sep 12, 2018 4:44 pm
by harrald
What is the status on this?

Re: Change multiple tasks at once

Posted: Thu Sep 13, 2018 10:08 am
by pmiklashevich
Not scheduled to be fixed, should be doable with some simple custom code.

Re: Change multiple tasks at once

Posted: Thu Sep 13, 2018 10:23 am
by harrald
If that is the case. Could you give me some directions on how to implement this?

Re: Change multiple tasks at once

Posted: Thu Sep 13, 2018 10:50 am
by pmiklashevich
You can start from investigating how Sch.plugin.DragSelector works. Looks pretty similar, except of that thing that you need the resize operation be involved instead of drag. And you might be interested in Sch.feature.ResizeZone. But how to implement what you need is only up to you. If you get stuck with it and feel like you need professional services, please contact sales@bryntum.com for a quote.

Re: Change multiple tasks at once

Posted: Thu Sep 13, 2018 12:24 pm
by pmiklashevich
In case you don't need a real time resizing (I mean visual effect), here is a simple solution. You can listen for eventresizestart/eventresizeend, calc delta of start resizing and end resizing and apply this value for all selected records except the one you manually resized.

Re: Change multiple tasks at once

Posted: Thu Sep 13, 2018 12:35 pm
by harrald
at the moment i have a proof of concept working like this:

InRowTaskDragDrop.js:475

Code: Select all

onTaskRowDragDrop : function(gantt, target, dropSource, data, e) {
            var me = this,
                eXY,
                task;

            if (data.isTaskDrag && (me.getConstrainDragToTaskRow() || Ext.fly(data.item).contains(target))) {

                gantt.getSelection().forEach(task => {
                    eXY = e.getXY();

                    console.log('withSnappedTaskCoordinates', task);
                    // The method contains the logic to snap task to exact drop start/end dates
                    withSnappedTaskCoordinates(
                        eXY[0],
                        data.startPointDate,
                        task,
                        gantt,
                        // Here at the drop time we need to calculate new start / end dates exactly how it will be adjusted
                        // after taking into account snapping and weekend skipping settings, thus we pass true here
                        // instead of me.getShowExactDropPosition()
                        true,
                        me.getSnapRelativeToEventStartDate(),
                        me.getSkipWeekendsDuringDragDrop(),
                        me.skipWeekends,
                        function(newStartDate, newEndDate, newStartDateX, newEndDateX) {
                            var valid = true;

                            // Processing drop only if task's start date is to be changed
                            if (task.getStartDate() - newStartDate) {

                                // Validating drop with user supplied validatorFn
                                if (me.getValidatorFn()) {
                                    valid = (false !== (me.getValidatorFn())(task, newStartDate, newEndDate - newStartDate, e));
                                }

                                valid && me.processDrop(gantt, target, task, newStartDate, newEndDate, dropSource, data, e, function() {
                                    doDefaultDropProcessing(me, task, newStartDate, newEndDate);
                                });
                            }
                        }
                    );
                });

                //task = data.record;
                //
                // eXY = e.getXY();
                //
                // // The method contains the logic to snap task to exact drop start/end dates
                // withSnappedTaskCoordinates(
                //     eXY[0],
                //     data.startPointDate,
                //     task,
                //     gantt,
                //     // Here at the drop time we need to calculate new start / end dates exactly how it will be adjusted
                //     // after taking into account snapping and weekend skipping settings, thus we pass true here
                //     // instead of me.getShowExactDropPosition()
                //     true,
                //     me.getSnapRelativeToEventStartDate(),
                //     me.getSkipWeekendsDuringDragDrop(),
                //     me.skipWeekends,
                //     function(newStartDate, newEndDate, newStartDateX, newEndDateX) {
                //         var valid = true;
                //
                //         // Processing drop only if task's start date is to be changed
                //         if (task.getStartDate() - newStartDate) {
                //
                //             // Validating drop with user supplied validatorFn
                //             if (me.getValidatorFn()) {
                //                 valid = (false !== (me.getValidatorFn())(task, newStartDate, newEndDate - newStartDate, e));
                //             }
                //
                //             valid && me.processDrop(gantt, target, task, newStartDate, newEndDate, dropSource, data, e, function() {
                //                 doDefaultDropProcessing(me, task, newStartDate, newEndDate);
                //             });
                //         }
                //     }
                // );
            }
        },
There is indeed no need for realtime dragging of all tasks. so this seems sufficient