Our pure JavaScript Scheduler component


Post by bfixell »

I am using an interval to re-selects the data for my project to ensure the end user sees changes made by other users. I am using the same endpoints I use to initially load data - but when I set the data property of the datastores - the dependency lines are all removed from scheduler.

We are using scheduler 5.6.7 now and the issue remains.

I am loading the data in this order:

   
function refreshSheduleData() { var promiseStack = []; promiseStack.push(webix.ajax().headers({ "Authorization": userLoggedIn.Token, "Content-type": "application/json" }).get(apipath + "/api/Events/GetResources")); promiseStack.push(webix.ajax().headers({ "Authorization": userLoggedIn.Token, "Content-type": "application/json" }).get(apipath + "/api/Events/GetEvents")); promiseStack.push(webix.ajax().headers({ "Authorization": userLoggedIn.Token, "Content-type": "application/json" }).get(apipath + "/api/Events/GetAssignments")); promiseStack.push(webix.ajax().headers({ "Authorization": userLoggedIn.Token, "Content-type": "application/json" }).get(apipath + "/api/Events/GetDependencies")); webix.promise.all(promiseStack).then(function (results) { var resources = results[0].json(); var events = results[1].json(); var assignments = results[2].json(); var dependencies = results[3].json(); scheduler.project.resourceStore.data = resources; scheduler.project.eventStore.data = events; scheduler.project.assignmentStore.data = assignments; scheduler.project.dependencyStore.data =dependencies; }); }

Initial loading - scheduler looks great

before.GIF
before.GIF (105.78 KiB) Viewed 153 times

Then the refresh routine runs and all the dependencies are no longer drawn

After.GIF
After.GIF (136.55 KiB) Viewed 153 times

Once the screen has re-painted with no dependencies, if I apply a filter to the data, the dependencies then appear. So the data is there - its just not being drawn when I initially set the new dependencyStore data. I also tried setting dependencyStore.data = []; and then applying the new data on another line - but this had the same result. All the code fires before the screen has repainted.

This may again be due to the size of the dataset we are using. I had a different issue reported here
viewtopic.php?t=27744&hilit=bfixell&start=10 where the scroll to resource function was firing before the screen repainted and failed.

Perhaps you can use the same data that I sent for that request to test this refresh function.

I am refreshing the scheduler using an interval. The current setting refreshes every 30 seconds for testing, but will be longer once the system is live.

 var idt = setInterval(function () {
            idleTime = idleTime + 1;
            if (idleTime == 6) {
            	idleTime = 0;
                refreshSheduleData()
            }
        }, 5000);

Post by bfixell »

Here is another interesting note - if I comment out updating resourceStore.data - everything works fine. The reason I want to refresh the resources is not because the list will change, but we timestamp each resource whenever the schedule for the resource is modified. I am using that time stamp to send schedule changes to the server. I could create code to update the resources based on the latest time stamps rather than replace using resourceStore.data - but I was hoping it would just work the way the other stores do.

Since the resourceStore is creating the issue - perhaps that is why calling or clearing filters forces the lines to appear once the screen is repainted.


Post by marcio »

Hey bfixell,

Thanks for reaching out and sorry for the late reply.

So, the issue happens only when updating the resourceStore? Are you able to reproduce a similar behavior on one of our demos? Or perhaps sharing a sample project for us to debug (with some data samples)?

The snippet you shared looks like the correct way to set the inline data, so we would need the test case to debug deeply what's happening there.

Best regards,
Márcio


Post Reply