Page 1 of 1

[ANGULAR] How to use my APIs in the events

Posted: Thu Sep 22, 2022 9:59 am
by boyitech

Hi,

Now i'm using the Tasks application demo (Angular). I want to use my APIs in my own server but I don't know what to do.
For example , when I add a new resoure item, drag an event to a new location or click 'Save' button when finishing editing event, what should I do that I can listen to these events and use my APIs to send my parameters to my server through functions?

Thanks.


Re: [ANGULAR] How to use my APIs in the events

Posted: Thu Sep 22, 2022 10:53 am
by alex.l

Re: [ANGULAR] How to use my APIs in the events

Posted: Thu Sep 22, 2022 11:49 am
by liuxiang

I listened to the save method. How to get the event data (modified data) currently clicked ?


Re: [ANGULAR] How to use my APIs in the events

Posted: Thu Sep 22, 2022 12:25 pm
by boyitech

I used this way to listen to my button event but I can't find any paramter I filled in the Edit Event Form. Where these parameters are or what should I do?

Here's the code:

editorConfig: {
          bbar: {
            items: {
              saveButton: {
                listeners: {
                  click(a) {
                    console.log(a);
                  }
                }
              }
            }
          }
        },

Re: [ANGULAR] How to use my APIs in the events

Posted: Thu Sep 22, 2022 2:30 pm
by tasnim

To listen for event save, please use this https://bryntum.com/docs/scheduler-pro/api/SchedulerPro/feature/TaskEdit#event-afterEventSave

Here is an example

listeners : {
	afterEventSave({ eventRecord }) {
		// logic here
	}
}

Best,
Tasnim


Re: [ANGULAR] How to use my APIs in the events

Posted: Fri Sep 23, 2022 11:23 am
by liuxiang

I have implemented listeners of afterEventSave, but the "this" object cannot be obtained in the afterEventSave method.

listeners: {
      afterEventSave({ eventRecord }) {
        console.log(this);      // output undefined
      },
},

What should I do?


Re: [ANGULAR] How to use my APIs in the events

Posted: Fri Sep 23, 2022 11:33 am
by alex.l

What do you expect to have as a scope of this method?
The scope of JS functions is depends on many aspects, same for listeners, as well on the way you add listeners and declared method.
Please review event params list https://bryntum.com/docs/scheduler-pro/api/SchedulerPro/feature/TaskEdit#event-afterEventSave
If you expected to have editor as a scope, it's available in params.

Also review docs https://bryntum.com/docs/scheduler-pro/api/Core/mixin/Events#function-on
There are few ways to add listeners, also possible to set a scope for the listener.


Re: [ANGULAR] How to use my APIs in the events

Posted: Fri Sep 23, 2022 11:47 am
by liuxiang

Can you provide some demos about angular?


Re: [ANGULAR] How to use my APIs in the events

Posted: Fri Sep 23, 2022 11:58 am
by alex.l

Sure.
All demos are available in sources you downloaded.
Please check by path: /examples/frameworks/angular
also examples-scheduler/frameworks/angular