shlomiassaf / ngrid

A angular grid for the enterprise
https://shlomiassaf.github.io/ngrid
MIT License
240 stars 39 forks source link

pbl-ngrid throwing error when changing pages on Angular project. #215

Open pasaku opened 2 years ago

pasaku commented 2 years ago

Current error message showing is this while changing pages:

TypeError: Cannot read properties of undefined (reading 'prev' ... pebula-ngrid.js:4164

On line 4167, could you please add an Elvis Operator here before 'prev' and 'current':

this.focusChanged = this.focusChanged$
            .pipe(buffer(this.focusChanged$.pipe(debounceTime(0, asapScheduler))), map(events => ({ prev: events[0]?.prev, curr: events[events.length - 1]?.curr })));

angular12

Al00X commented 2 years ago

bump, I have this issue too. Thanks in advance.

Al00X commented 2 years ago

Ok after months with no response from devs, I managed to monkey patch it till they fix it. Solution:

// Temporary fix for error: reading property of undefined, "prev"
setTimeout(() => {
      const originalDestroy = this.table._extApi.contextApi.destroy;
      this.table._extApi.contextApi.destroy = () => {
        try {
          originalDestroy();
        } catch {}
      };
    }, 1);