Premium support for our pure JavaScript UI components


Post by kevin.snps »

Hi team,

Regarding with viewtopic.php?p=99146#p99146, I have one thing I want to ask.

I took over Shinya's task and have a question to ask. We have tried "gantt.dependencyStore.getAt(3).lag = 10", to reassign the lag to the dependency in our scheduler and was successful.
But now, I am facing a problem that the event goes back to where it used to be for a moment, then goes to where I have dragged to. I am assuming that the event is going back when the reassigning of the lag is happening.
Though, I am not sure of it, so I want to know the cause of the event going back, and a way to prevent this.

Codes and datas I am using are the same as the files attached to the post linked above. (they are codeSample.js, dependenciesData.json and eventsData.json)

I will also attach clips of what I want to achieve, and what I currently have.
webite_sample.gif is a screenshot of what I want to achieve, and as you can see, it is a sample that I have found on you website. going_back.gif.gif is what I currently have, and after the d-n-d action, the event goes back for just a moment, and settles in where I have dragged.

F.Y.I, this going-back happens only when the event is dragged backwards in time, and doesn't happen for the other direction.
If there is some information missing, please let me know.

Thank you.

Attachments
going_back.gif
going_back.gif (280.21 KiB) Viewed 929 times
website_sample.gif
website_sample.gif (355.85 KiB) Viewed 929 times

Post by alex.l »

I see the only difference in your examples that your top image has rounded the startDate with bigger increment value.

As far as I see you need to change https://bryntum.com/docs/scheduler-pro/api/Scheduler/preset/ViewPreset#field-timeResolution

An object containing a unit identifier and an increment variable. This value means minimal task duration you can create using UI. For example when you drag create a task or drag & drop a task, if increment is 5 and unit is 'minute' that means that you can create a 5 min long task, or move it 5 min forward/backward. This config maps to scheduler's timeResolution config.

Please try to tune it and let us know if you achieved your goal.

All the best,
Alex


Post by kevin.snps »

Hi alex,

thanks for the prompt reply. I have tried to tune the time resolution, and was able to change the increment value. But the event still goes back right after the d-n-d action.

I will attach the code that I have added, and the screenshot of the current scheduler. The field of timeResolution in the code is what I have added.

I would appreciate your continued support.

createScheduler(component, data) {
    const container = this.template.querySelector('.container');
    this.scheduler = window.schedulerpro =
      new bryntum.schedulerpro.SchedulerPro({
        project: {
          calendar: this.targetCalendar,
          resourcesData: this.resources,
          eventsData: this.events,
          assignmentsData: this.assignments,
          calendarsData: this.calendars,
          dependenciesData: this.dependencies,
          stm: {
            autoRecord: true,
          },
        },

    columns: this.columns,
    startDate: this.startDate,
    endDate: this.endDate,
    rowHeight: 50,
    barMargin: 2,
    viewPreset: this.viewPreset,
    timeResolution: {
      unit: 'minute', //Valid values are "millisecond", "second", "minute", "hour", "day", "week", "month", "quarter", "year".
      increment: 5,
    },
    multiEventSelect: true,
...
Attachments
going_back2.gif
going_back2.gif (351.99 KiB) Viewed 902 times

Post by alex.l »

Please post a runnable test case that we can debug. Unfortunately, I cannot reproduce that in our examples.
Remember to remove node_modules folder before zip your app.

All the best,
Alex


Post by kevin.snps »

Hi alex,

due to our company's policy, I cannot post my whole app for debug. Instead, I will post the whole section related to the calculation of dependency in d-n-d action(the version of SchedulerPro is v4.3.3). Hope that this will help us tackle this problem. Please let me know if there is more I can do.

Attachments
dependencies.zip
(4.3 KiB) Downloaded 67 times

Post by alex.l »

Did you try to disable all your custom code for manual lag set? Did it work the same for you? I see you call calculateDependenciesData after event drop.

All the best,
Alex


Post by kevin.snps »

Hi alex,

thanks for going through my zip file. By disabling my custom code, the going back wwent gone, and worked the same as the example on the website. But what I want to manage is, to set a lag with my custome code, and work like your example.

I might find a way through if you could tell me how the scheduler is calculating and set the lag in your product. I might do the same thing, or override the method with my custom code.

I see you call calculateDependenciesData after event drop.

Does this mean that calculateDependenciesData is called after the d-n-d action? Maybe you can also teach me how to call this method just where the d-n-d action is happening.

Thanks.


Post by alex.l »

Yes, there is a race-condition thing. Changing record data during drag is not supported.
You should overthink your solution and try to use this instead https://bryntum.com/docs/gantt/api/Scheduler/feature/EventDrag#event-beforeEventDropFinalize
But anyway, it won't be smooth if you change data "on the fly".

Actually, if you don't have constraints for your task (constraintDate or lags in dependencies), it should be possible to move it as you want. Of course, in limits of your dependencies. You can try it here: https://bryntum.com/examples/gantt/advanced/

But actually what exactly do you want to achieve by doing this?

All the best,
Alex


Post by kevin.snps »

Hi Alex,

thanks for the reply. Scheduler.feature.EventDrag#event-beforeEventDropFinalize was what I was looking for. I was able achieve what I wanted to. Thank you so much!


Post Reply