jQWidgets Forums

jQuery UI Widgets Forums Angular jqxGrid in Angular: Incomplete component destruction

Tagged: , ,

This topic contains 2 replies, has 2 voices, and was last updated by  admin 7 years, 9 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author

  • Christian
    Participant

    Dear jqWidgets Team

    The jqxGrid Angular component does not seem to clean up its event handlers completely. After navigating away from an Angular route containing a jqxGrid, there still seems to be an active ‘mousemove’ handler that keeps the ngZone from stabilizing.

    Version: 5.4.0 – Commercially licensed edition

    HTML:
    <jqxGrid #gridReference></jqxGrid>
    In my component:

      @ViewChild('gridReference')
      grid: jqxGridComponent;
    
      ngOnDestroy(): void {
          // The jqxGrid component does not seem to implement ngOnDestroy, therefore we do it ourselves
          this.grid.destroy();
      }

    To see the problem, in the main component add:

      constructor(zone: NgZone) {
        zone.onStable.subscribe(() => {
          console.log('Stable');
        });
        zone.onUnstable.subscribe(() => {
          console.log('Unstable');
        });
      }

    After visiting a page using the jqxGrid, ‘Unstable’ / ‘Stable’ is triggered on every mouse movement, which clearly indicates that the event handler is not unregistred.

    How can I get the grid component to completely clean upon destruction?

    Cheers
    Christian


    Christian
    Participant

    After some investigation, I believe that there is a bug in the resize logic of jqWidgets core (jqxcore.js).
    On destruction, the watchedElementData array is not cleaned up and a setInterval is done on these elements to wait for them to become visible again (jqxcore.js:9641). This will never happen, as the component is already destroyed. The interval then stays alive forever and prevents the Angular Zone from stabilizing.


    admin
    Keymaster

    Hi Christian,

    We will look into this, if it’s an issue or not.

    Regards,
    Peter

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.