Change multiple tasks at once

Ask for help related to our 2.x versions.
Post Reply
User avatar
glenh123
Posts: 101
Joined: Wed Jul 25, 2012 10:37 am

Change multiple tasks at once

Post by glenh123 » Sun Jul 07, 2013 3:36 am

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

User avatar
mats
Core Developer
Core Developer
Posts: 14657
Joined: Sat Dec 19, 2009 11:41 pm
Location: Sweden
Contact:

Re: Change multiple tasks at once

Post by mats » Sun Jul 07, 2013 3:18 pm

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.
Tired of debugging javascript errors in web applications? Try our new error logging service RootCause, or read more on the Sencha blog

@bryntum
Facebook
API documentation

User avatar
glenh123
Posts: 101
Joined: Wed Jul 25, 2012 10:37 am

Re: Change multiple tasks at once

Post by glenh123 » Thu Jun 04, 2015 7:42 am

Hi

Has this function been implemented yet?

Thanks

User avatar
arcady
Core Developer
Core Developer
Posts: 2222
Joined: Wed Mar 20, 2013 6:57 am

Re: Change multiple tasks at once

Post by arcady » Thu Jun 04, 2015 7:57 am

No, unfortunately it's not yet. The ticket is still there.

User avatar
harrald
Posts: 29
Joined: Tue May 01, 2018 10:59 am

Re: Change multiple tasks at once

Post by harrald » Wed Sep 12, 2018 4:44 pm

What is the status on this?

User avatar
pmiklashevich
Core Developer
Core Developer
Posts: 2301
Joined: Fri Apr 01, 2016 11:08 am

Re: Change multiple tasks at once

Post by pmiklashevich » Thu Sep 13, 2018 10:08 am

Not scheduled to be fixed, should be doable with some simple custom code.
Pavel Miklashevich - Core Developer

User avatar
harrald
Posts: 29
Joined: Tue May 01, 2018 10:59 am

Re: Change multiple tasks at once

Post by harrald » Thu Sep 13, 2018 10:23 am

If that is the case. Could you give me some directions on how to implement this?

User avatar
pmiklashevich
Core Developer
Core Developer
Posts: 2301
Joined: Fri Apr 01, 2016 11:08 am

Re: Change multiple tasks at once

Post by pmiklashevich » Thu Sep 13, 2018 10:50 am

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.
Pavel Miklashevich - Core Developer

User avatar
pmiklashevich
Core Developer
Core Developer
Posts: 2301
Joined: Fri Apr 01, 2016 11:08 am

Re: Change multiple tasks at once

Post by pmiklashevich » Thu Sep 13, 2018 12:24 pm

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.
Pavel Miklashevich - Core Developer

User avatar
harrald
Posts: 29
Joined: Tue May 01, 2018 10:59 am

Re: Change multiple tasks at once

Post by harrald » Thu Sep 13, 2018 12:35 pm

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

Post Reply