We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How do I access/get the currently active ScheduleModel

I need to print a heavily customized scheduler view with different height (and width) settings then the screen view.

I know that the newer versions allow to pass a ScheduleModel to the print function, but when I pass only height and width a parameter/settings I loose all customization. How can I get the full currently active ScheduleModel with all customization and pass it to the print function after altering the settings I need to change? Or is there a different way to achieve what I need?

If the print function also accepts a partial ScheduleModel (only the changes), then I would assume the printing is invoked before the heavily customized schedule finished re-rendering (there are several callbacks on re-rendering events; assume those callback functions are available/will be called also during re-rendering for printing).


Any help highly welcome.

print

Method allows to print the scheduler.

ParameterTypeDescription
printOptions (optional)ScheduleModelThe export options to be set before start with exporting
the Scheduler events to the print window.

1 Reply

VR Vijay Ravi Syncfusion Team January 23, 2023 04:14 PM UTC

Hi Julius,


The print method with printOptions doesn’t have the template, and events support. You can print the Schedule with all customization with help of the print method without printOptions of the Schedule by setting up the dynamic width and height values to the Schedule before calling the print method as shown in the below code snippet.


Sample: https://stackblitz.com/edit/ej2-angular-schedule-print-with-options-sample-nfhtre?file=app.component.ts


[app.component.ts]

  public onPrintIconClick(): void {

    let height = this.scheduleObj.height;

    let width = this.scheduleObj.width;

    // Changing the width and height of the scheduler to fit to the current window width

    this.scheduleObj.height = "auto";

    this.scheduleObj.width =  “auto;

    // Refreshing the layout of the scheduler

    this.scheduleObj.refreshLayout();

    window.setTimeout(() => {

      this.scheduleObj.print();

      window.setTimeout(() => {

        // Changing the width and height to the original values

        this.scheduleObj.height = height;

        this.scheduleObj.width = width;

        // Refreshing the layout of the scheduler

        this.scheduleObj.refreshLayout();

      }, 2000);

    }, 1000);

  }


Regards,

Vijay Ravi


Loader.
Up arrow icon