Our pure JavaScript Scheduler component


Post by thomasb »

I use two schedulers (partnered)

I made one collapsible

// config

collapsible: {
    type: 'inline',
    collapsible: true
},
collapsed: true

// template:

[collapsed]="config.collapsed"
[collapsible]="config.collapsible"

So far so good.

I'm struggling to programmatically expand or collapse the scheduler.
Toggling 'config.collapsed = true/false' doesn't seem to work. I tried some methods but couldn't find the one that works.

Any help would be appreciated.
Thanks,


Post by tasnim »

Hi,

You should apply this on the instance instead of the config

scheduler2Instance.collapse()
scheduler2Instace.expand()

Here is a guide on how to get the scheduler instance https://bryntum.com/products/scheduler/docs/guide/Scheduler/integration/angular/guide#bryntum-scheduler-api-instance

Hope this helps.

Best regards,
Tasnim


Post by thomasb »

Thanks for your quick reply.

const scheduler = this.scheduler as any;
scheduler.expand();

like this it indeed works. Which type can i use instead of any? 'Scheduler' or 'SchedulerPro' don't work.


Post by tasnim »

Hi,

If you follow the guide https://bryntum.com/products/scheduler/docs/guide/Scheduler/integration/angular/guide#accessing-the-bryntum-scheduler-instance properly, you should get the typings properly. You should not need to add your own typings to it.

Don't get the typings properly?

Best regards,
Tasnim


Post by thomasb »

Indeed, the typings are not properly set.

This is the TS error I get when i hover 'expand':

Expected 1 arguments, but got 0.ts(2554)
schedulerpro.d.ts(77133, 12): An argument for 'idOrRecord' was not provided.

The description is:

(method) GridBase.expand(idOrRecord: string | number | Model): Promise<void>
Expand a single node. This function is exposed on Grid and can thus be called as grid.expand()

@param idOrRecord — Record (the node itself) or id of a node to expand

Post by thomasb »

The setup:

<bryntum-scheduler-pro
  #scheduler

</bryntum-scheduler-pro>
import { BryntumSchedulerProComponent } from '@bryntum/schedulerpro-angular';
import { LocaleManager, ResourceStore, SchedulerEventModel, SchedulerPro } from '@bryntum/schedulerpro';

export class Component implements OnInit, OnDestroy {
  private scheduler!: SchedulerPro;
  @ViewChild(BryntumSchedulerProComponent) schedulerProComponent! : BryntumSchedulerProComponent;

  ngAfterViewInit(): void {
    this.scheduler= this.schedulerProComponent.instance;
  }
}

Post by marcio »

Hey thomasb,

That looks like a bug.

I created a ticket to fix that type https://github.com/bryntum/support/issues/9407.

As a workaround, you can use the any for not triggering the TS error.

Best regards,
Márcio


Post Reply