Our pure JavaScript Scheduler component


Post by aalbert »

Hello,

I am currently trying to build a feature that saves the state of the page (e.g. in database) and can then later restore that state. The Scheduler Pro's (schedulerpro-angular) column filter values should, among other things, be captured by that state. So I am looking for a way to programmatically enter a value in the filterBar (restore state) as well as reading the current value (save state; which I can hopefully get done more elegantly than (this.scheduler?.getSubGrid('locked') as any).columns.allRecords.$filter.value). The restoration of the state should happen such that the filter value is also visibly written in the Filter Bar, as if the user entered it himself.

Thanks a lot!

Albert


Post by mats »

This is all supported already via the StateProvider. Did you check this demo? https://bryntum.com/examples/scheduler/state


Post by aalbert »

Hello Mats, thank you for answering.

I wasn't aware of it yet, this will probably help me. As I am trying it out I was able to retrieve the state using

StateProvider.instance.getValue('some-state-id')

while I tagged the scheduler like this:

  <bryntum-scheduler-pro stateId="some-state-id" ...> </bryntum-scheduler-pro> 

and set the StateProvider up in the constructor of my component, trying out both

StateProvider.setup('local')
StateProvider.setup('memory')

However when calling

StateProvider.instance.setValue(...)

asynchronously with the very object I obtained previously using getValue, the Scheduler doesnt update, I am not able to see the filters I set before running getValue. Am I missing a step?


Post by marcio »

Hey aalbert,

Can you share a runnable test case so we can inspect how you are trying to set the state? You can have more info on that by checking our guidelines here https://www.bryntum.com/forum/viewtopic.php?f=1&t=772.

As you can see in the demo that Mats shared, you load the state first and then render the component.

Also, after assigning the state provider to the Scheduler, you should use scheduler.stateProvider directly from your instance, and not the StateProvider object.

Attachments
Screenshot 2024-09-05 at 14.29.24.png
Screenshot 2024-09-05 at 14.29.24.png (593.21 KiB) Viewed 128 times

Best regards,
Márcio


Post Reply