Our pure JavaScript Scheduler component


Post by plus »

Since I have updated scheduler version to 4.1.0
When I click on Save Button in Event Editor, nothing happends

What can be the problem?

I also have another problem in event editor,
When I try to change date or hour or when I close editor I have this error message:

My project use italian language

ERROR Error: Uncaught (in promise): Error: Id collision on SU,MO,TU,WE,TH,FR,SA
Error: Id collision on SU,MO,TU,WE,TH,FR,SA
at Store.onDataReplaced (scheduler.module.js:27404)
at Store.loadData (scheduler.module.js:27868)
at Store.setStoreData (scheduler.module.js:27792)
at Store.set data [as data] (scheduler.module.js:27720)
at Store.set (scheduler.module.js:1948)
at Store.setConfig (scheduler.module.js:3088)
at Store.configure (scheduler.module.js:3014)
at Store.construct (scheduler.module.js:2660)
at Store.construct (scheduler.module.js:4909)
at Store.construct (scheduler.module.js:23256)
at resolvePromise (zone-evergreen.js:798)
at new ZoneAwarePromise (zone-evergreen.js:963)
at EventEditor.hide (scheduler.module.js:44272)
at EventEditor.close (scheduler.module.js:54929)
at Tool.callback (scheduler.module.js:2818)
at Tool.onClick (scheduler.module.js:52354)
at HTMLButtonElement.handler (scheduler.module.js:36121)
at ZoneDelegate.invokeTask (zone-evergreen.js:399)
at Object.onInvokeTask (core.js:27474)
at ZoneDelegate.invokeTask (zone-evergreen.js:398)


Post by alex.l »

Hi plus,

How can we reproduce this? Do you see it in our examples? Please, provide clear steps to reproduce and a runnable test case so we will be able to reproduce the problem and investigate it.

All the best,
Alex

All the best,
Alex


Post by plus »

>How can we reproduce this? Do you see it in our examples?
No, but the only thing I do is change readonly properties at runtime in beforeEventEditShow

listeners: {
    beforeEventEditShow({ editor, eventRecord }) {

  console.log('beforeEventEditShow');
  console.log(eventRecord);
  if (eventRecord.tipoDato == 1 || eventRecord.tipoDato==undefined) {
    this.features.eventEdit.readOnly = false;
    if (eventRecord.idTask == '' || eventRecord.idTask==undefined) {
      editor.eventEditFeature.nameField.editable = true;
      editor.eventEditFeature.nameField.clearable = true; 
    } else {
      editor.eventEditFeature.nameField.editable = false;
      editor.eventEditFeature.nameField.clearable = false;
    }
  } else {
    this.features.eventEdit.readOnly = true;
    editor.eventEditFeature.nameField.editable = false;
  }

},
beforeEventSave({ editor, eventRecord }) {
  console.log('beforeEventEditSave');
}

I tried to use beforeEventSave but the event is not raised

When i start application I set scheduler to readOnly then after login I evaluate if user has grant and I change readonly properies

private setResourcesSchedulerReadOnly(readOnly : boolean)
  {
    if (this.resourcesScheduler != undefined)
    {
      this.resourcesScheduler.readOnly = readOnly;
      this.resourcesScheduler.tbar.readOnly = false;
      this.resourcesScheduler.features.eventDragCreate = !readOnly
      this.resourcesScheduler.features.cellMenu.items.removeRow = !readOnly
      this.resourcesScheduler.features.eventMenu.items.deleteEvent = !readOnly;
      this.resourcesScheduler.features.eventMenu.items.unassignEvent = !readOnly;
      this.resourcesScheduler.features.eventMenu.items.moveForward.disabled = readOnly;
      this.resourcesScheduler.features.eventMenu.items.moveBackward.disabled = readOnly;

  this.resourcesScheduler.features.eventEdit.readOnly = readOnly; //<--

}
  }

Any suggestion about this error?
ERROR Error: Uncaught (in promise): Error: Id collision on SU,MO,TU,WE,TH,FR,SA


Post by mats »

No sorry, very hard to say without a proper test case. Can you please modify one of our samples and upload it here so we can see same thing you are seeing?


Post by plus »

Today in my project I only tried to come back and use version 4.0.3, I didn't touch my code and everything it's ok.
Save, delete and cancel buttons in event editor works fine.
I don't have any error when I change date or time.

Unfortunelly, 4.0.1 solve another bug, but in my case is less important than this

When I have time to investigate the problem I'll try to make a demo.

Can you try to investigate this problem again?
In the future I wish to stay update with your new releases


Post by pmiklashevich »

Hello,

Please update the product to the latest version, modify any of shipped demos to replicate you issue, produce steps to reproduce and see the error you see. Keep in mind, a testcase should have minimal code to reproduce. Please see here how to report a problem: viewtopic.php?f=35&t=772

Regarding the way you change the readOnly status for features, menus, editor, etc. Please keep in mind that all the features, menus, editors aware of the scheduler they are attached to and respect its readOnly status. So you can instantiate your scheduler having readOnly equals to true:

new Scheduler({
    readOnly : true,
....
});

The event editor fields will be read only, not editable, the delete/save buttons will be hidden. The editor will just display the info. All default menu items will be hidden, therefore if there is no custom menu items, the menu won't be shown.
Then when you check the user rights, you can set scheduler readOnly to false. After that editor we work as usual and the menu items will be shown.

If you want to add custom menu item, you need to control it's visibility manually. For that, add eventMenuBeforeShow listener to scheduler and depending on the scheduler readOnly status set the visibility. For example:

new Scheduler({
    readOnly : true,
    features : {
        eventMenu : {
            items : {
                test : {
                    text : 'foo',
                    onItem() {
                        console.log('click');
                    }
                }
            }
        }
    },
    listeners : {
        eventMenuBeforeShow({ source : scheduler, items }) {
            if (scheduler.readOnly) {
                items.test = false;
            }
        }
    },

Please reconsider your approach of controlling read only status and let us know if it works for you now.

If not, please provide a detailed report with the steps to reproduce.

Best,
Pavel

Pavlo Miklashevych
Sr. Frontend Developer


Post by plus »

I have investigated the problem.
The error is due to localization.
I attach a document to the message in which I explain the problem

In summary, I have two items with the same value
day and weekday

How can I adapt my localization code to version 4.1.0
Or maybe there is some problem in the scheduler code?

Attachments
errore localizzazione bryntum 4.1.0.pdf
(343.46 KiB) Downloaded 110 times

Post by saki »

Would it be possible for you to post it in a form that we could actually run and debug (set breakpoints, see value in the variables, etc.)? It is closely impossible to look at pdf and trying to figure out what could be wrong.

The only one thing that popped up was:

day: 'SU,MO,TU,WE,TH,FR,SA', // shouldn't this be 'giorno' ?
weekday: 'SU,SA', // shouldn't this be 'feriale'?

while in German locale it is defined as:

day           : 'Tag',
weekday       : 'Wochentag',

Post by plus »

day: 'SU,MO,TU,WE,TH,FR,SA', // shouldn't this be 'giorno' ?
weekday: 'SU,SA', // shouldn't this be 'feriale'?

this was just a test that I had done, but it did not solve, the problem is still there by removing these two lines

I can't get a demo ready quickly and I can't post the whole project.

I was hoping to be able to explain the problem, which is basically the duplication of this value in the images

but which does not depend on my code.

Using the same localization file with 4.0.3 I had no problems

Attachments
03.png
03.png (111.91 KiB) Viewed 2679 times
02.png
02.png (187.97 KiB) Viewed 2679 times
01.png
01.png (89.57 KiB) Viewed 2679 times

Post by plus »

I tried to change this line of code in scheduler.module.js

 buildLocalizedItems() {
    const me = this;
    me._weekDays = null;
    return me.weekDays.concat([{
      value: me.allDaysValue,
      text: me.L('L{day}'),
      cls: me.splitCls
    }, {
      value: 'MO,TU,WE,TH,FR',//me.workingDaysValue,
      text: me.L('L{weekday}')
    }, {
      value: me.nonWorkingDaysValue,
      text: me.L('L{weekend day}')
    }]);
  }

and everything works fine

I attach three images of debug values
Please could you investigate this issue?

Attachments
06.png
06.png (22.53 KiB) Viewed 2679 times
05.png
05.png (80.32 KiB) Viewed 2679 times
04.png
04.png (75.56 KiB) Viewed 2679 times

Post Reply