Premium support for our pure JavaScript UI components


Post by peterjc »

Hi, I have recently upgraded to scheduler 3.1.3 in my Ionic 4/Angular 8 application.

I have the following code that has always been there...
private setupTimeScalePresets(): void {
    try {
      this.viewPreset = 'hourAndDay';

      PresetManager.registerPreset(this.viewPreset, {
        tickWidth: 35,
        rowHeight: 10,
        displayDateFormat: 'HH:mm',
        shiftIncrement: 1,
        shiftUnit: 'day',
        timeResolution: {
          unit: 'hour',
          increment: 0.08
        },
        defaultSpan: 24,
        headers: {
          unit: 'hour',
          dateFormat: 'HH:mm'
        }
      });
    } catch (error) {
      this.loggerBase.error(`setupTimeScalePresets: ${error}`);
    }
  }
The only change here was to the headers, ie I went from
// 2.3
        headerConfig: {
          middle: {
            unit: 'hour',
            increment: 1,
            dateFormat: 'HH:mm'
          }
        }
to
 // 3.1.3
        headers: {
           unit: 'hour',          
           dateFormat: 'HH:mm'
         }     
Now when I call this, I get the following exception...
"Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method."
If I get vscode to break at the exception, this is where it is coming from...
error.png
error.png (44 KiB) Viewed 4800 times
Note the argument "o" is undefined.

I am not sure if it is related, but I do currently hide my top timescale column by the following css
/** Hide time scale top row */  
  .b-sch-header-row-0 {
      display: none !important;
  }
So this gives me the following..
header.png
header.png (12.43 KiB) Viewed 4800 times
Funny enough, even with this exception it seems to appear how I want, in fact I remove this code and I still get the result I am after.

I initially added this when I was first looking at the scheduler, and was a little confused with the presets

So I will remove it for now, but just curious as to what I am doing wrong in my call?

Thanks in advance

Later I may want to add different "scalings"

Post by mats »

What browser are you using?

Post by peterjc »

Hi Mats, this using using Chrome.

Post by saki »

I think that it is because headers now have to be an array, not object. See the example in the docs.

Post by peterjc »

Hi Saki, yes this was the problem.

I put it into an array, and no more exception.

Also, I no longer need the
 .b-sch-header-row-0 {
       display: none !important;
  }
so just have the single header row.

Thank you!

Post Reply