Our pure JavaScript Scheduler component


Post by eugen »

Hi Forum,

thanks for the great product! I really like it a lot.

I don't know why, but the switch from the trial version of the normal Scheduler in version 2.8 to the Scheduler Pro in full license in the same version broke some of the implementations in the Angular project, without changing something on these parts:

  • I have a class that overwrites the "EventModel" class to add new fields and functions. Before the change, I could easy take an eventRecord in an event listener and use "Object.assign(...)" to create a new instance of our class with the eventRecord data inside. This is no longer working and leads to an "Error: Uncaught (in promise): TypeError: Cannot assign to read only property '$$' of object '[object Object]' / TypeError: Cannot assign to read only property '$$' of object '[object Object]'".

  • Next to this I used the HTML input directives "[events]" and "[resources]" to set the event and resource data in the scheduler. I also re-set the input values on some actions in the code to re-define the resources and events in a loaded state of the scheduler. This worked perfectly before, but now I get an "Error: Cycle during synchronous computation" error on "ResourceStore.setStoreData" and the resource data is not changed in the scheduler.

I tried to fix it, but I don't find out how, because it worked perfectly before the switch and I find no other ways to do this in the documentation.

Hope this description helps you. Would be very great, if someone could help!

Kind Regards
Eugen


Post by tasnim »

Hi,

It's really hard to say what's wrong without testing. Could you please upload a test case here so we could run the angular app and debug it?


Post by eugen »

Hi Tasnim,

Sure I can provide a small example project. In the project you will find the Angular frontend and a small backend with two simple routes.

You can see the first error in the browser console when you hover over an event. The second error you can force by clicking on the "Load Edited Data" button and confirm the re-loading message (re-load data from backend).

As I said this code worked in the trial version of version 2.8 of the normal scheduler. The only thing we changed is from trial to payed and from normal scheduler to pro.

Thanks for helping out!
Eugen

Attachments
example-project.zip
(178.15 KiB) Downloaded 45 times

Post by Animal »

It should be a lot simpler to get your data into the Store. You do not have to go through those steps of massaging it and injecting it.

I loaded your JSON data into one of our running examples by configuring the project like this:

    project : {
        autoLoad : true,
        loadUrl  : './data/data.json',

        // Change the JSON to what the CrudManager expects
        listeners : {
            beforeResponseApply({ requestType, response }) {
                response.events = { rows : response.eventData };
                response.resources = { rows : response.resourceData };
            }
        },

        // Override the startDate and endDate to use a raw millisecond value
        eventStore : {
            fields : [{
                name       : 'startDate',
                dataSource : 'startTimeMilliseconds',
                convert(v) { return new Date(v)}
            }, {
                name       : 'endDate',
                dataSource : 'endTimeMilliseconds',
                convert(v) { return new Date(v)}
            }]
        }
    }

And then to display the right time span, the Scheduler configuration has these:

    startDate  : new Date(1970, 0, 5),
    endDate    : new Date(1970, 3, 30),
    viewPreset : 'weekAndDayLetter',

And it just pops into life:

Screenshot 2023-04-28 at 07.08.02.png
Screenshot 2023-04-28 at 07.08.02.png (140.66 KiB) Viewed 1223 times

Post by eugen »

Good morning.

Thanks for the hint. I'll have a look at the TaskEditor demo in detail and give you feedback if that clears everything up or if there are any further questions.

Kind regards,
Eugen


Post by eugen »

Hello,

So with your hint and the task example, I got mostly everything working as I want it. Thanks.

One last question stayed open: When you look in the SchedulerConfig of the project (test-case.config.ts), you see that I have disabled eventEdit and set readOnly to true. But when I double-click on an event, it still opens the event editor. Why is this not working?

Thanks again for helping!
Eugen


Post by marcio »

Hey Eugen,

Are you able to share the updated version of your project for us to check?

Best regards,
Márcio


Post by eugen »

Hi,

Sorry for the late answer, we had some important tasks to do.

Here is the updated example-project. As I said, the re-load and object assign errors are now fixed based on the example you provided. Thanks again for that.

But we found another error that, besides the fact that we have disabled eventEdit and set readOnly to true in our SchedulerConfig (test-case.config.ts), editing on e.g. double-clicking an event is still enabled. Do you know what's wrong here?

Thanks again for helping!
Eugen

Attachments
example-project-02.zip
(178.31 KiB) Downloaded 46 times

Post by tasnim »

Hi,

Could you please provide some details on how to run the backend?


Post by eugen »

Good morning,

Sorry that it took so long this time. We had some tasks with a very tight schedule, so the open ticket here kind of fell under the table. Now I am more available again and can answer more timely.

Sure, I can provide that: The backend is a Python FastAPI backend that runs without a database. For the implementation, python 3.10.x is used. There are two possibilities to run the backend:

  • Install "PyCharm (IDE)", "Python 3.10.x" and "Poetry" on you machine, open the backend-directory in PyCharm, configure the poetry python interpreter and run the "main.py" in PyCharm.
  • Run it with docker. With that, you don't need to install everything. I added a version of the backend with Dockerfile and docker-compose.yml, so you simply have to build the image and run the docker-compose to get the running backend. I guess that's much more easy than install everything.

Thanks again for helping!
Eugen

Attachments
backend.zip
(2.21 KiB) Downloaded 45 times

Post Reply